Is there a way to filter UltraGrids based on the value of 2 columns?

zneak picture zneak · Jun 14, 2012 · Viewed 7.5k times · Source

Say I have an Infragistic UltraGrid with columns Foo and Bar. Is it possible to filter the table so that only rows where Foo and Bar are not equal are displayed?

For instance, if I had this data:

Foo  Bar
--------
0.1  0.1
0.1  0.2
0.2  0.2

The filter would hide the first and the third row.

Answer

Dmitriy Konovalov picture Dmitriy Konovalov · Aug 6, 2012

It is simplier than it seems and i am sure you do not have to create additional column or something:

UltraGridColumn fooColumn = Grid.DisplayLayout.Bands[0].Columns["Foo"];
UltraGridColumn barColumn = Grid.DisplayLayout.Bands[0].Columns["Bar"];
ColumnFilter fooColumnFilter = fooColumn.Band.ColumnFilters[fooColumn];
fooColumnFilter.ClearFilterConditions();
fooColumnFilter.FilterConditions.Add(FilterComparisionOperator.NotEquals, barColumn);