Reputation: 138141
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.
Upvotes: 4
Views: 9179
Reputation: 1817
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);
Upvotes: 5
Reputation: 3228
Since you are not allowing users to toggle this filter and are using a DataTable, the simplest solution is to filter the DataTable rather than the grid.
For example if your DataTable is fooData you would use the follwoing:
fooData.DefaultView.RowFilter = "Foo <> Bar";
Upvotes: 1
Reputation: 21722
You should be able to do this from the Grid designer;
[Foo]!=[Bar]
to your data source.DisplayLayout.Override.RowFilterMode = RowFilterMode.AllRowsInBand
.grid.DisplayLayout.Band[].ColumnFilters
, add a new FilterLogicalOperator.And
with the new column's FilterConditions.Add(FilterComparisionOperator.Equals, true)
.Upvotes: 1