Get the databound object for a cell given column and row index

I have the column and row index of a cell and I would like to retrieve the object that is bound to that row/cell.

What method or technique could I use to retrieve that information?


3 Replies 1 reply marked as answer

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team August 30, 2021 05:06 PM UTC

Hi Zachary, 
 
Thanks for contacting Syncfusion Support. 

Query#:-I have the column and row index of a cell and I would like to retrieve the object that is bound to that row/cell. 

We have achieved your requirement using getRowInfo method of the TreeGrid. Using this method, we can get the rowData information by passing its corresponding row element. 

Refer to the code below:- 
App.Component.ts 
export class AppComponent { 
            public data: Object[] = []; 
            public pageSettings: Object; 
            @ViewChild('treegrid') 
            public treeGridObj: TreeGridComponent; 
 
            ngOnInit(): void { 
                this.data = sampleData; 
                this.pageSettings = { pageSize: 10 }; 
            } 
            onClicked(): void { 
                 
                var rowElem = this.treeGridObj.getRowByIndex(2);  // get the corresponding row 
                var data = this.treeGridObj.getRowInfo(rowElem).rowData;  // get rowData from getRowInfo 
                console.log(data); 
            } 
        } 

 
Please get back to us if you need any further assistance. 

Regards, 
Farveen sulthana T 


Marked as answer

ZA Zachary August 30, 2021 08:10 PM UTC

This worked. Thank you!



FS Farveen Sulthana Thameeztheen Basha Syncfusion Team August 31, 2021 08:03 AM UTC

Hi Zachary,  

Thanks for your update. Please get back to us if you need any further assistance. We are happy to assist you. 

Regards, 
Farveen sulthana T 


Loader.
Up arrow icon