This is a migrated thread and some comments may be shown as answers.

Filtering and Hidden Columns

3 Answers 142 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 12 Oct 2012, 01:12 AM
Hi All

I have a scenario where a user has a grid with a menu, in that menu they can pick a bunch of options which dictate which columns are shown and which columns are not.

Some of the hideable columns have filters on them. I am using a single rowmodel, and as such, if the user filters on a column,  then hides it, they get a different set of information but the filter remains applied, and the grid is filtered. This is done because the first 5 or so columns are common and then the remaining columns change.

What is the best way to remove a filter when the column is hidden?

Regards,
Ian

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Oct 2012, 05:41 AM
Hi Ian,

 You can check the grid FilterDescriptors collection for specific ColumnFilterDescriptor where the descriptor Column property IsVisible is set to false and remove this descriptor.

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ian
Top achievements
Rank 1
answered on 21 Nov 2012, 08:08 AM
Hi Vlad

This is the approach we took, however upon the user electing to display the columns on which the filterdescriptors have been removed, it shows that the column is still "filtered" (the button/arrow in the column header to display the filtering popup is coloured) and when you open the filtering menu, the previously selected distinct filtering options are still selected, however they are no longer having any effect on the grid. Changing these options or selecting other distinct filters also no longer has any effect on the grid.

It is also worth noting that we are using custom distinct filters.

Thanks,
Ian
0
Rossen Hristov
Telerik team
answered on 21 Nov 2012, 10:50 AM
Hi,

To clear a filter programmatically, please follow the documentation.

You should use the ClearFilters method of the column. It will do everything for you.

All the best,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Ian
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ian
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or