Filtering Event not Fired

5 posts, 0 answers
  1. Adolfo Marinucci
    Adolfo Marinucci avatar
    11 posts
    Member since:
    Sep 2009

    Posted 27 Jan 2010 Link to this post

    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!
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 28 Jan 2010 Link to this post

    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.
  3. Adolfo Marinucci
    Adolfo Marinucci avatar
    11 posts
    Member since:
    Sep 2009

    Posted 28 Jan 2010 Link to this post

    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!

  4. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 02 Feb 2010 Link to this post

    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.
  5. Paul
    Paul avatar
    7 posts
    Member since:
    Mar 2011

    Posted 10 Apr 2012 Link to this post

    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?
Back to Top