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
125
client-side row.getChildRow in GroupByMode
posted

I'm trying to loop through the rows of a grid.  My function works fine when not grouped, but something is going awry when grouped.

I'm looping through the top level grid.Rows.  On each row I check if row.ChildRowsCount > 0.  Which it is on the second iteration.

After that I have an alert showing me row.ChildRowsCount and row.getChildRows.length.  The first is 4 but the second is 0.

I also tried row.getChildRow(0), which is null.

Any help please?

Parents
No Data
Reply
  • 3732
    posted

    Hi,

    You can check if the band is grouped or not and then loop through it. Here is a code snippet:

    var band = igtbl_getBandById(cellId);

    var row = igtbl_getRowById(cellId);

    var rowCount = row.ChildRowsCount;

    alert(rowCount);

    if(band.IsGrouped)

    {

    var count = row.ChildRowsCount;

    alert(count);

    }

    This shows how to check if grouping is done. The ChildRowsCount property of Row object returns the number of child rows. If its more than 0 then you can access the child row by  it's index.

    Hope this helps.

Children