Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2585
Select child row when grid is grouped by column
posted

Is there a way to get the row data when the grid is grouped by a column. We can get the row as shown below but when we then try to get the data for the row by index it does not work correctly when the grid has a group by a column. If you remove the grouping we can get the data just fine.

 

var row = $('.selector').igGrid('selectedRow');

 

$('.selector').data('igGrid').dataSource.dataView()[row.index];

Parents
  • 2355
    Suggested Answer
    Offline posted

    Hello Tammy,

    Thank you for posting in our forums! The row index is not the same as your expected because the group rows are taken into account. The simplest workaround is to get all of the grid’s rows and exclude the group rows. Then you can find the index of the selected row in the array of “data” rows. And this will be the index that you will use to get the row from the data view. I prepared a small sample page that demonstrates my solution. Please let me know if this works for you!

    I’m looking forward to your reply!

    Kind regards,
    Petko Zhekov
    Software Engineer

    sample-row-data-groupby.zip
Reply Children