GridView with custom filter

5 posts, 1 answers
  1. Paul
    Paul avatar
    42 posts
    Member since:
    Jan 2012

    Posted 27 Mar 2013 Link to this post

    I am attempting to persist a gridview with custom filteringer.  I am using the GridViewCustomPropertyProvider class in your example and see that I am hitting the ProvideValue method but in the if condition for FilterDescriptors I have no ColumnFilterDescriptor which IsActive is true.  If I remove my custom filter I do find the IsActive column.

     

    My custom filter does function get applied to the grid as I am implementing the IFIlteringControl.  I also do have an IsActive DependencyProperty on my class.  In fact, the basis for my custom control was from your example code as well.

    Is there some issue with using the PersistanceManagers Save method when the filter is a custom filter or am I missing something?

    Thanks

    Paul
  2. Paul
    Paul avatar
    42 posts
    Member since:
    Jan 2012

    Posted 28 Mar 2013 Link to this post

    I created ticket 676488 to include a sample project.

    Thanks

    Paul
  3. UI for WPF is Visual Studio 2017 Ready
  4. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 01 Apr 2013 Link to this post

    Hi Paul,

    We posted a reply in the support thread you stared. Basically, in order to persist the custom filter, you need to customize the GridViewCustomPropertyProvider. You need to slightly change the ProvideValue() and RestoreValue() methods to save/load the settings of your custom filtering control.

    And as we suggested in the support thread, you can access the columns FilteringControl and if it's not null and it is active, then you can make sure to save its settings (the properties of the custom CategoricalCustomFilterControl). You can try to extend the current logic of the ProvideValue() method - when saving the FilterDescriptors like so:
    if (settings.Count == 0)
    {
        foreach (GridViewDataColumn column in gridView.Columns
            .OfType<GridViewDataColumn>())
        {
            FilterSetting setting = new FilterSetting();
     
            setting.ColumnUniqueName = column.UniqueName;
     
            if (column.FilteringControl != null && column.FilteringControl.IsActive)
            {
                var customDescr = column.FilteringControl as CategoricalCustomFilterControl;
                if (customDescr != null)
                {
                    //save the customDescr properties in the setting object
                }
            }
        }
    }

    Let us know if that helps or if we can further assist you.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Paul
    Paul avatar
    42 posts
    Member since:
    Jan 2012

    Posted 01 Apr 2013 Link to this post

    I am using the FilterControl now and do get my categorical results which I manage the same way the Distinct values are.  I have additional filter controls, numeric, date and textual, which use a composite filter.  I expect to use the Filter1 and Filter2 objects to persist those values.

    Thanks

    Paul
  6. Paul
    Paul avatar
    42 posts
    Member since:
    Jan 2012

    Posted 01 Apr 2013 Link to this post

    The implementation went in place very well. This recommendation did resolve my problem.

    Thank you for your assistance.

    Paul
Back to Top
UI for WPF is Visual Studio 2017 Ready