We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to get the cell value by specifying the column and row

hi,

Is there a way to get the value of a particular cell by specifying column and row.

Thank you and best regards,

Kalum



3 Replies 1 reply marked as answer

PS Pavithra Subramaniyam Syncfusion Team March 14, 2023 04:49 AM UTC

Hi kalum,


Thanks for contacting Syncfusion support.


You can get the cell value from the row index and column index by using the “getCellFromIndex” method. If you have only the column field value, then you can get the index by using the “getColumnByField” method. Please refer to the below code example and the API link for more information.


document.getElementById('getValue').addEventListener('click', (e) => {

  var colIndex = grid.getColumnByField('CustomerName').index; // to get the column index

  console.log(grid.getCellFromIndex(1, colIndex).innerText); // this will return the cell value from the second row since the row index starts from 0

});

 


API        : https://ej2.syncfusion.com/documentation/api/grid/#getcellfromindex

                https://ej2.syncfusion.com/documentation/api/grid/#getcolumnbyfield


Regards,

Pavithra S


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Marked as answer

KA kalum March 16, 2023 11:29 AM UTC

Hi Pavithra,

Your solution works fine and thank you very much for the help.

Kalum



SG Suganya Gopinath Syncfusion Team March 17, 2023 05:38 AM UTC

Hi Kalum, 

We are glad that the provided solution helped. We are marking this thread as solved.  


Loader.
Live Chat Icon For mobile
Up arrow icon