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
470
Group By not showing expanded child rows when iterating
posted

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

  • 469350
    Verified Answer
    Offline posted

    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

     

  • 69832
    Offline posted

    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.