'宣言 Public Overloads Sub EnsureSortedAndFiltered()
public void EnsureSortedAndFiltered()
' 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
// 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; }