简体   繁体   中英

Infragisitcs ultrawingrid columnchooser and column filters

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?

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 (ie 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM