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
265
Hide expansion indicator on parent if all children are filtered out
posted

Is it possible to hide the expansion indicator on the parent row in a multiband grid if all of the child rows have been filtered out? 

I have a grid which is loaded with a dataset containing two tables and a relation is then added.  Outside the grid, there are two date selectors.  The child rows are filtered based on the dates in the date selectors.  I would like the expansion indicator on the parent row to be hidden if all the child rows are filtered out.  I have the expansion indicator set to CheckOnExpand in the InitializeLayout event on the grid, but that doesn't achieve what I want. 

As you can see, the expansion indicator is showing next to row 1, even though all the child rows are filtered out.  Please let me know if there is a way to hide it. 

Note that I am filtering using the following code:

gridFlights.DisplayLayout.Bands(1).ColumnFilters.ClearAllFilters()
        gridFlights.DisplayLayout.Bands(1).ColumnFilters("OriginationDate").FilterConditions.Add(FilterComparisionOperator.GreaterThanOrEqualTo, DateFrom.Value)
        gridFlights.DisplayLayout.Bands(1).ColumnFilters("OriginationDate").FilterConditions.Add(FilterComparisionOperator.LessThanOrEqualTo, DateTo.Value)

Thank you.

Parents
  • 2560
    Verified Answer
    Offline posted
    Hello John,

    Thank you for posting to Infragistics community!

    I have been looking into your question and created a small sample in VB demonstrating how your requirement can be achieved. You can find it attached below.

    My suggestion is to iterate the UltraGrid’s Rows collection after applying the filter condition. For each row, you could check if the FilteredInNonGroupByRowCount of the Rows collection of the particular child band is equal to 0. If so, the current row’s ExpansionIndicator property can be set to “Never”. Additionally, you could collapse the row and its child rows, in case they were expanded at the time of applying the filter:

     

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Me.UltraGrid1.DisplayLayout.Bands(1).ColumnFilters.ClearAllFilters()
            Me.UltraGrid1.DisplayLayout.Bands(1).ColumnFilters("Column 0").FilterConditions.Add(FilterComparisionOperator.Contains, 3)
            For Each row As UltraGridRow In Me.UltraGrid1.Rows
                If row.ChildBands(0).Rows.FilteredInNonGroupByRowCount.Equals(0) Then
                    row.ExpansionIndicator = ShowExpansionIndicator.Never
                    row.ChildBands(0).Rows.CollapseAll(True)
                    row.Expanded = False
                End If
            Next
        End Sub

    I assume that removing the filter condition is done programmatically as well, since there will be no way to expand the child band, if the parent row’s expansion indicator is hidden. Upon removing it, the UltraGrid’s Rows collection could to be iterated again, to revert the ExpansionIndicator property of each row back to “CheckOnDisplay”.

    Please, test the sample on your side and if you require any further assistance on the matter, please let me know.

     

    Sincerely,
    Bozhidara Pachilova
    Associate Software Developer
Reply Children
No Data