Infragisitcs ultrawingrid columnchooser and column filters

4.2k Views Asked by At

I have an Infragistics UltraWinGrid and I'm using its built-in column chooser.

However there is an issue whereby if a user has a filter on a particular column, then hides that column, the filter is still applied to the data.

I would expect that if the column is hidden then its filter should no longer apply OR I should at least be able to set this somehow.

I've looked and can't find a way of doing this. Any ideas?

2

There are 2 best solutions below

0
On BEST ANSWER

When a column is hidden, the UltraWinGrid.AfterColPosChanged event is fired. The event arguments don't tell you which column has had its position changed (i.e. hidden) so the easiest thing to do it iterate over the columns and clear the filters of any hidden columns.

private void grid_AfterColPosChanged(object sender, AfterColPosChangedEventArgs e)
{
    foreach (UltraGridBand band in grid.DisplayLayout.Bands)
    {
       foreach (ColumnFilter filter in band.ColumnFilters)
       {
            if (filter.Column.Hidden)
            {
                filter.ClearFilterConditions();
            }
       }
   }
{

Clunky, but it works.

2
On

Handle column hiding; just bind Column.Hidden to your object and do whatever you need to do.