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

GridView with custom filter

4 Answers 78 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 27 Mar 2013, 02:52 PM
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

4 Answers, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 28 Mar 2013, 07:56 PM
I created ticket 676488 to include a sample project.

Thanks

Paul
0
Accepted
Tina Stancheva
Telerik team
answered on 01 Apr 2013, 08:02 AM
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.

0
Paul
Top achievements
Rank 1
answered on 01 Apr 2013, 01:45 PM
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
0
Paul
Top achievements
Rank 1
answered on 01 Apr 2013, 02:43 PM
The implementation went in place very well. This recommendation did resolve my problem.

Thank you for your assistance.

Paul
Tags
PersistenceFramework
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or