This is a migrated thread and some comments may be shown as answers.
Filtering Event not Fired
4 Answers 56 Views
This is a migrated thread and some comments may be shown as answers.
Adolfo Marinucci
Top achievements
Rank 1
Adolfo Marinucci asked on 27 Jan 2010, 03:20 PM
Hi,

I'm working on a Silverlight project that include your RadGridView and I've to say that it is really great.
Now I've a problem when implementing a custom filtering control for a DateTime column. I followed a sample included into the downloaded zip that creates a filtering control with a "from" datetime picker and a "to" datetime picker.
The issue comes when adding a composite filter descriptor to the RadGridView.FilterDescriptors collection, the Filtering event is not fired.
I need to handle such event to add a standard filterdescriptor to the domaindatasource which in turn post the composite filter to the server.
The following is the Filtering handler:

        private void RadGridView_Filtering(object sender, Telerik.Windows.Controls.GridView.GridViewFilteringEventArgs e)  
        {  
            using (dds.DeferLoad())  
            {  
                foreach (Telerik.Windows.Data.FilterDescriptor d in e.Removed)  
                {  
                    RemoveDomainDataSourceFilterDescriptor(d);  
                }  
 
                foreach (Telerik.Windows.Data.FilterDescriptor d in e.Added)  
                {  
                    AddDomainDataSourceFilterDescriptor(d);  
                }  
            }  
        } 

I don't know if it is a bug or I'm missing something,
Thanks!

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 28 Jan 2010, 07:38 AM
Hello,

Filtering event will be fired only when you filter from the grid UI - when you add descriptor to the collection by yourself you do not need event since you know that you just filtered the grid.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Adolfo Marinucci
Top achievements
Rank 1
answered on 28 Jan 2010, 11:22 AM
Hi,
thank you for your reply.
If I have correctly understood, when user select a "from date" or a "to date", the resulting filterdescriptor that my custom filtering control creates must be added to the radgridview filterdescriptors collections and ALSO to the filterdescriptors collection of the DomainDataSource.
Is this correct?

If so, I'm just wondering why the standard filtering control (the one that is shown by defualt, that shows the distinct values) when applies the filterdescriptor also causes a Filtering event.

Thanks!

0
Rossen Hristov
Telerik team
answered on 02 Feb 2010, 01:09 PM
Hello Adolfo Marinucci,

You are correct. If you want filtering to be performed on both the client and the server, then you should add a descriptor to both RadGridView and to the DomainDataSource.

The Filtering event is for scenarios when you are using our default filtering control (you have no control over filtering) and want to do something after filtering occurs -- for example filter the DomainDataSource. Or anything else as a matter of fact. Our customers that do not develop their own filtering control like you do, might still need to perform something when filtering has happened through the UI and this event is their only chance to do that.

Since you have developed your own custom filtering control -- you are in total control over what happens and when and you can do anything that you need to. That is why you do not need the event in such a case, since you know when filtering happens.

I hope this makes sense.

Best wishes,
Ross
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Paul
Top achievements
Rank 1
answered on 10 Apr 2012, 04:38 PM
A seperate question on the same subject but how would Bold the column header of the column that was just sorted on?  Would you have a code snippet?
Asked by
Adolfo Marinucci
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Adolfo Marinucci
Top achievements
Rank 1
Rossen Hristov
Telerik team
Paul
Top achievements
Rank 1
Share this question
or