Infragistics(R) NetAdvantage(R) Windows Forms
RecursionType Enumeration
Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : RecursionType Enumeration

Enum specifying level of recursion to apply to a RowCollection method

Syntax

Visual Basic (Declaration) 
Public Enum RecursionType 
   Inherits System.Enum
C# 
public enum RecursionType : System.Enum 

Members

MemberDescription
All Apply recursively to all rows
Expanded Apply recursively to all expanded rows
None No recursion

Example

The following code demonstrates the use of the RowsCollection overloaded EnsureSortedAndFiltered methods

Visual BasicCopy Code
' The RowsCollection overloaded EnsureSortedAndFiltered methods afford the developer fine- 
' grained control over synchronous row sorting and filtering.

' This can be usefull in situations where the grid contains a large number of records and
' the developer wishes to display a wait cursor during a sort or filter.  By default the grid
' applies sorting and filtering lazily to rows in each band as it is expanded.  The parameterless
' method simply ensures that the RowsCollection upon which it is called is synchronously sorted
' and filtered.

' Ensure all rows in the current row collection are synchronously sorted and filtered.
Me.ultraGrid1.Rows.EnsureSortedAndFiltered()

' The two additional overloads take as arguments a RecursionType enum value and an UltraGridChildBand
' specifying the lowest level in the hierarchy to apply the synchronous sort and filter.
' Specifying a RecursionType of "None" will ensure the current RowCollection is synchronously sorted
' and filtered.  Specifying "All" or "Expanded" will ensure that either all rows, or all expanded rows, in the 
' specified Bands are synchronously sorted and filtered.  The method will be called called recursively on the
' current Band and all child bands until the lowest level Band is reached or all bands if the lowestLevelBand is null.

' Ensure all rows in the topmost row collection and the rows in all bands below this band in the
' hierarchy are synchronously sorted and filtered.
Me.ultraGrid1.Rows.EnsureSortedAndFiltered(RecursionType.All)

' Ensure all expanded rows in the topmost row collection and the expanded rows in all bands below
' this band in the hierarchy are synchronously sorted and filtered.
Me.ultraGrid1.Rows.EnsureSortedAndFiltered(RecursionType.Expanded)

' Ensure all rows in the specified row collection and the rows in all bands below this band in the
' hierarchy down to the specified lowest level band are synchronously sorted and filtered.
Dim lowestLevelBand As UltraGridChildBand = Me.ultraGrid1.Rows(3).ChildBands(5)
Me.ultraGrid1.Rows(3).ChildBands(2).Rows.EnsureSortedAndFiltered(RecursionType.All, lowestLevelBand)


' The following code demonstrates how to display a wait cursor and specify a synchronous sort and filter
' for a selected set of rows in the grid hierarchy.
Private Sub ultraGrid1_BeforeSortChange(sender As Object, e As Infragistics.Win.UltraWinGrid.BeforeSortChangeEventArgs)

   ' Set the wait cursor
   Me.ultraGrid1.Cursor = Cursors.WaitCursor
   
   ' Ensure all rows in the specified hierarchical range are synchronously sorted and filtered
   Dim lowestLevelBand As UltraGridChildBand = Me.ultraGrid1.Rows(3).ChildBands(5)
   Me.ultraGrid1.Rows(3).ChildBands(2).Rows.EnsureSortedAndFiltered(RecursionType.All, lowestLevelBand)

End Sub 'ultraGrid1_BeforeSortChange


Private Sub ultraGrid2_AfterSortChange(sender As Object, e As Infragistics.Win.UltraWinGrid.BandEventArgs)

   ' Reset the wait cursor
   Me.ultraGrid1.Cursor = Cursors.Default

End Sub 'ultraGrid2_AfterSortChange
C#Copy Code
// The RowsCollection overloaded EnsureSortedAndFiltered methods afford the developer fine- 
// grained control over synchronous row sorting and filtering.

// This can be usefull in situations where the grid contains a large number of records and
// the developer wishes to display a wait cursor during a sort or filter.  By default the grid
// applies sorting and filtering lazily to rows in each band as it is expanded.  The parameterless
// method simply ensures that the RowsCollection upon which it is called is synchronously sorted
// and filtered.
            
// Ensure all rows in the current row collection are synchronously sorted and filtered.
this.ultraGrid1.Rows.EnsureSortedAndFiltered();
            
// The two additional overloads take as arguments a RecursionType enum value and an UltraGridChildBand
// specifying the lowest level in the hierarchy to apply the synchronous sort and filter.
// Specifying a RecursionType of "None" will ensure the current RowCollection is synchronously sorted
// and filtered.  Specifying "All" or "Expanded" will ensure that either all rows, or all expanded rows, in the 
// specified Bands are synchronously sorted and filtered.  The method will be called called recursively on the
// current Band and all child bands until the lowest level Band is reached or all bands if the lowestLevelBand is null.

// Ensure all rows in the topmost row collection and the rows in all bands below this band in the
// hierarchy are synchronously sorted and filtered.
this.ultraGrid1.Rows.EnsureSortedAndFiltered( RecursionType.All );

// Ensure all expanded rows in the topmost row collection and the expanded rows in all bands below
// this band in the hierarchy are synchronously sorted and filtered.
this.ultraGrid1.Rows.EnsureSortedAndFiltered( RecursionType.Expanded );

// Ensure all rows in the specified row collection and the rows in all bands below this band in the
// hierarchy down to the specified lowest level band are synchronously sorted and filtered.
UltraGridChildBand lowestLevelBand = this.ultraGrid1.Rows[3].ChildBands[5];
this.ultraGrid1.Rows[3].ChildBands[2].Rows.EnsureSortedAndFiltered( RecursionType.All, lowestLevelBand );


// The following code demonstrates how to display a wait cursor and specify a synchronous sort and filter
// for a selected set of rows in the grid hierarchy.

       private void ultraGrid1_BeforeSortChange(object sender, Infragistics.Win.UltraWinGrid.BeforeSortChangeEventArgs e)
       {
	        // Set the wait cursor
	        this.ultraGrid1.Cursor = Cursors.WaitCursor;

	        // Ensure all rows in the specified hierarchical range are synchronously sorted and filtered
	        UltraGridChildBand lowestLevelBand = this.ultraGrid1.Rows[3].ChildBands[5];
           this.ultraGrid1.Rows[3].ChildBands[2].Rows.EnsureSortedAndFiltered( RecursionType.All, lowestLevelBand );
       }

       private void ultraGrid1_AfterSortChange(object sender, Infragistics.Win.UltraWinGrid.BandEventArgs e)
       {
	        // Reset the wait cursor
	        this.ultraGrid1.Cursor = Cursors.Default;       
       }

See Also