hello,
i am using synfusion gridview with column including text field and wanted to know if there a method to loop through rows and get column values.
Thank you,
Best Regards,
Hi Jack,
Thanks for contacting Syncfusion support.
Query: Iterate through grid rows
Based on your query, you need to iterate through the rows and get the column values. We can achieve this by using getRows method to get the all the rows and get the required row’s details using getRowInfo method to get the information of the Respective row. Now you are able to get the column values
For your convenience, we have attached documentation for your reference.
Documentation:
https://ej2.syncfusion.com/javascript/documentation/api/grid/#getrows
https://ej2.syncfusion.com/javascript/documentation/api/grid/#getrowinfo
Please get back to us if you need further assistance on this.
Regards,
Mohammed Ansar ,
hello,
thank you for your reply and for the information provided.
I have tried multipe scripts but i am not able to loop and get always object or empty result i am using below sample :
var gridObj = document.getElementById('Listgrid').ej2_instances[0] //Grid Instance
var getRows = gridObj.getRows(); //get the grid rows by invoking getRows() method
for (var i = 0; i < getRows.length ; i++) {
var val = gridObj.getRowInfo(gridObj.getRows()[i]) ;
}
appreciate if i can have a small working similar sample.
thank you for your help,
Regards,
Hi Jack,
Greetings from Syncfusion support.
Query: To get the column value through iteration
Based on your query, you need to get the column values through iteration. You send us your code example. we suspect that you get the column elements through iteration. For values you need get rowData from getRowInfo method and access your corresponding field name to get the value of corresponding column.
we modified the provided code for more information.
|
var gridObj = document.getElementById('Listgrid').ej2_instances[0] //Grid Instance var getRows = gridObj.getRows(); //get the grid rows by invoking getRows() method for (var i = 0; i < getRows.length ; i++) { var val = gridObj.getRowInfo(gridObj.getRows()[i]) ; } val.rowData.OrderID// OrderID is my field name |
Please get back to us, if you need further information.
Regards,
Mohammed Ansar ,
hello Mohammad,
Thank you for your answer , it is working perfectly now and returned values
appreciate your help,
best Regards,
Hi Jack,
Thanks for your update.
We are happy to hear that issue has been resolved.
Please get back to us if you need further assistance on this.
Regards,
Mohammed Ansar ,