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

Custom filter control and removing filtering on grid

2 Answers 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Miłosz Cechnicki
Top achievements
Rank 1
Miłosz Cechnicki asked on 23 Dec 2011, 10:04 AM
Hello,

I'm using on some column custom filtering controls. Everything works great, until I want to remove all filters on grid using method:
this.View.grid.FilterDescriptors.Clear();

In the control I'm creating an ColumnFilterDescriptor object, passing the current column as constructor parameter.

Then this filter is added as follows:
this.fieldFilter.FieldFilter.Filter1.Value = this.PhotoStatuses.Where(s => s.IsSelected).Select(s => s.StatusValue).ToList();
 
                if (!this.column.DataControl.FilterDescriptors.Contains(this.fieldFilter))
                {
                    this.column.DataControl.FilterDescriptors.Add(this.fieldFilter);
                }

When clearing FilterDescriptors collection, filter indicator on all grid columns, that uses default filter controls, shows, that filter is disabled. But on columns, that uses CustomFilterControls, filter indicator is still Active, and after clicking it- filter control is still filled with last selected filter.

Should I do it in another way?

Best regards

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 26 Dec 2011, 01:51 PM
Hello Miłosz,

 Do you set the filter indicator to be IsActive=True or it becomes active once you add some filter descriptors? Have you followed this blog post to implement your custom filtering?

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dimitrina
Telerik team
answered on 26 Dec 2011, 02:04 PM
Hello Miłosz,

 I have an update. When you have applied your own custom filtering, the filtering control does not automatically turn off the filter indicator when the FilterDescriptors are cleared. You will need to do this manually by setting the IsActive property of the FilteringControl to False:

this.column.FilteringControl.IsActive = false;

Please check this and let me know how it works.

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Miłosz Cechnicki
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or