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

persist Datafilter

5 Answers 159 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
Kamran asked on 22 Nov 2011, 08:12 AM
I placed Datafilter on Popup window, which return FilterDescriptor. After that i add FilterDescriptor to Gridview. Up to now its working nice. If I again open popup, I want to set previous filter on Datafilter control, AS FilterDescriptor property of DataFilter is read only, kindly help me.

One other thing, I am using EditorTemplateSelector for custom input filter such as Combobox. Every time when I define EditorTemplateSelector for individual Item, it become hardcoded. I want a generic solution. DataFilter that I am using can have any collection, so its very difficult for me handle this situation. Can you send me sample solution, where i can use generic EditorTemplateSelector.

5 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 22 Nov 2011, 12:43 PM
Hello Kamran,

The FilterDescriptors property of RadDataFilter is read-only since it is a collection property and all collection properties are read only. You add and remove elements to a collection property, you do not assign it. So you can create a FilterDescriptor and add it to the FilterDescriptors collection of RadDataFilter. Persisting a .NET such as the FilterDescriptor is beyond the scope of our support.

As for the generic solution for your second question, I am afradi that it is not possible.

All the best,
Ross
the Telerik team

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

0
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 23 Nov 2011, 12:25 PM
Thanks for your support. I got the point, and implement this. Currently I got CompositeFilterDescriptorCollection from GridView, after that I assign this collection to RadDataFilter like
DataFilter.FilterDescriptors.Add(FilterDescriptor[0]);

But here is one issue, one extra and logical operator is added at the top of filter. Kindly find screen shot
0
Rossen Hristov
Telerik team
answered on 24 Nov 2011, 09:24 AM
Hello Kamran,

Can you please attach a sample project with this behavior. We need to debug it in order to see what you are doing. Also, please explain what is the end-goal that you are after and we will try to modify the project if it is achievable.

Kind regards,

Ross
the Telerik team

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

0
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 24 Nov 2011, 02:02 PM
Hi Team,
   Sorry I can't share source code but i can explain scenarios, I pass gridView.FilterDescriptors to popup screen

QueueFilter(this, gridView.FilterDescriptors as FilterDescriptorCollection);

at constructor QueueFilter I set filter to RadDAtaFilter

public QueueFilter(UserControl parent, FilterDescriptorCollection Filters)

            {

            InitializeComponent();

            FilterDescriptor = Filters as CompositeFilterDescriptorCollection;          

            ItemPropertyDefinition property;

            property = new ItemPropertyDefinition("request_id", typeof(string), "RequestCode");

            RADDataFilter.ItemPropertyDefinitions.Add(property);

 

            if (FilterDescriptor.Count > 0 && !FilterDescriptor[0].ToString().Equals("Empty"))

            {

                RADDataFilter.FilterDescriptors.Clear();

               RADDataFilter.FilterDescriptors.Add(FilterDescriptor[0]);

            }

at popup return i used following code.

this.DailogReturnData = RADDataFilter.FilterDescriptors;

Grid is filtered correctly, I think when i return Filter to main screen, there is some issue. 


0
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 28 Dec 2011, 11:58 AM
Hi All,

Use
 RADDataFilter.FilterDescriptors.AddRange(FilterDescriptorCollection );


instead of

RADDataFilter.FilterDescriptors.Add(FilterDescriptor);
Tags
DataFilter
Asked by
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Rossen Hristov
Telerik team
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
Share this question
or