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

Clearing filter after search/select

2 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
improwise
Top achievements
Rank 1
Iron
Iron
improwise asked on 30 Mar 2011, 02:50 PM
The build in filtering features of RadGrid are great in most cases, but there is still room for improvements I feel. One are is what happens after you filter, if you want to do multiple searches (filterings) after one another, which are not related to each other (like in a Customer Telephone support). This means that the customer service rep would have to manually clear the filters in order to be able to search for something else. This is especially tricky if you have enabled the AutoPostBackOnFilter which means that when you clear the previous filter, and moves to another filter, a select for EVERYTHING will be executed (as there now is no filter).

As far as I know, there is no "ClearFilterAfterSelect" option on the RadGrid, which could be a solution to this problem. The idea would of course be to clear (reset) the filters after a search/filter has been completed. What we have done is to implement this ourselves as:
       

foreach (GridColumn column in radGrid.MasterTableView.Columns)
{
            column.CurrentFilterFunction = GridKnownFunction.NoFilter;
            column.CurrentFilterValue = string.Empty;
 }

radGrid.MasterTableView.FilterExpression = string.Empty;

after the Select has been executed, but it would be nice to have this option. Or perhaps it already exists?

Also, it would be interesting to know if there are any drawbacks to this (besides having to fill in filter data again of course)?

2 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 31 Mar 2011, 09:15 AM
Hello Patrik,

Thank you for your suggestion.
I will forward your request to our developers for further consideration. They will have it in mind along with the input from other customers we have accumulated.

Best wishes,
Pavlina
the Telerik team
0
John
Top achievements
Rank 1
answered on 11 May 2012, 01:58 AM
Warning - Unintended side effects from above solution.

I've implemented the solution provided by the non tech support person above and it works great, kudos to them for posting helpful content on this site.

However, after implementing this the filters will not persist through page changes, if you use pagination.

Tags
Grid
Asked by
improwise
Top achievements
Rank 1
Iron
Iron
Answers by
Pavlina
Telerik team
John
Top achievements
Rank 1
Share this question
or