Infragistics(R) NetAdvantage(R) Windows Forms
ColumnFilters Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > RowsCollection Class : ColumnFilters Property

Column filters for filtering the rows in this rows collection. They will apply only if the UltraGridOverride.RowFilterMode resolves to SiblingRowsOnly.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property ColumnFilters As ColumnFiltersCollection
C# 
public ColumnFiltersCollection ColumnFilters {get;}

Example

Following sample code illustrates what RefreshFilters does and how it can be useful. It contains two button click handlers. Read the comments in those button click handlers for information on what they do. To test the sample code, click on the button associated with the first button click handler. You will notice in the ultragrid that one of the row doesn't match the filter criteria and is still visible. This is because we changed the row's value after filtering the rows. Now click the second button which calls RefreshFilters method to reapply the filters. This will hide the row that doesn't meet the filter criteria.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button104_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button104.Click

      ' Following code filters rows and after rows are filtered, it changes the value of a
      ' row that passed the filter conditions to a value that doesn't pass the filter conditions.
      ' The row won't get filtered out. It will still be visible. To re-filter it out, you 
      ' have to call RefreshFilters method.

      ' Filter rows by Country to show only rows with Country equal UK
      Me.UltraGrid1.Rows.ColumnFilters("Country").FilterConditions.Add(FilterComparisionOperator.Equals, "UK")

      ' Now get the first visible row and then change the Country of that row to France. Remember
      ' Country field of all the visible rows after applying the filter above is UK.
      Dim firstVisibleRow As UltraGridRow = Me.UltraGrid1.Rows.GetRowAtVisibleIndex(0)

      ' Change the Country of the row to France. Once you click this button, you will see
      ' that the first row has it's Country equal to France and all the other rows are
      ' UK.
      firstVisibleRow.Cells("Country").Value = "France"

  End Sub

  Private Sub Button105_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button105.Click

      ' Call RefreshFilters to reevaluate the filter conditions so if the data has changed
      ' in rows they get re-filtered.
      Me.UltraGrid1.DisplayLayout.RefreshFilters()

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button104_Click(object sender, System.EventArgs e)
{

	// Following code filters rows and after rows are filtered, it changes the value of a
	// row that passed the filter conditions to a value that doesn't pass the filter conditions.
	// The row won't get filtered out. It will still be visible. To re-filter it out, you 
	// have to call RefreshFilters method.

	// Filter rows by Country to show only rows with Country equal UK
	this.ultraGrid1.Rows.ColumnFilters["Country"].FilterConditions.Add( FilterComparisionOperator.Equals, "UK" );
	            
	// Now get the first visible row and then change the Country of that row to France. Remember
	// Country field of all the visible rows after applying the filter above is UK.
	UltraGridRow firstVisibleRow = this.ultraGrid1.Rows.GetRowAtVisibleIndex( 0 );

	// Change the Country of the row to France. Once you click this button, you will see
	// that the first row has it's Country equal to France and all the other rows are
	// UK.
	firstVisibleRow.Cells["Country"].Value = "France";

}

private void button105_Click(object sender, System.EventArgs e)
{

	// Call RefreshFilters to reevaluate the filter conditions so if the data has changed
	// in rows they get re-filtered.
	this.ultraGrid1.DisplayLayout.RefreshFilters( );			

}

Remarks

See Also