Hi, See code below
For Each row As UltraWinGrid.UltraGridRow In ugBackOrders.Rows If row.IsDataRow Then If row.Cells("Tick").Value = True Then Do Something End If End If Next
I have a grid of data, when I group by a field and run the code above it doesn't have the child rows in the ugBackOrders.Rows collection even if teh group is expanded and the row is in view?
Am I missing something here?
Thanks
I knew there would be an easy way! Thanks
You could write a recursive loop to walk down all the levels of grouping in the grid, but there is a much easier way.
The Rows collection has a number of methods that will make it much easier for you to get the rows you want.
In this case, you can do this:
For Each row As UltraWinGrid.UltraGridRow In ugBackOrders.Rows.GetFilteredInNonGroupByRows() If row.Cells("Tick").Value = True Then 'Do Something End If Next
The code above will get all the data rows on any level of the grid, excluding any rows that are filtered out.
If you want filtered rows, too, you could just do this:
For Each row As UltraWinGrid.UltraGridRow In ugBackOrders.Rows.GetAllNonGroupByRows() If row.Cells("Tick").Value = True Then 'Do Something End If Next
When you group by a column, the Rows collection only contains the UltraGridGroupByRows. UltraGridGroupByRow exposes a Rows collection, which contains each of the rows in that group.