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

Event before the grid is filtered

3 Answers 118 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Vikas
Top achievements
Rank 1
Vikas asked on 06 Oct 2016, 07:45 PM

I am using DataFilter and its source is Bind to the Grid, I don't want to use the unbound mode because then I will have to populate everything. I am using rest service to get all the data and I want to do the filtering also on the server side.

- User open the window

- I make a rest request to get the data and populate the grid

- User add a filter

- I am listening for the collection changed and item changed event

- I loop through all the filters and send a request to get the filtered data

The problem is that DataFilter also filters the grid on the client side, so If my rest request takes time the grid items source is updated twice, one from the data filter and another one when rest returns the data

Is there any preview event or any other way to tell datafilter ot not filter the grid

3 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 11 Oct 2016, 01:31 PM
Hello Vikas,

For your convenience, I prepared an example to demonstrate how to achieve the desired behavior. Please take a look at the implementation and consider how this approach fits your scenario.

I hope that this helps. Should you have any other questions, do not hesitate to contact us.

Regards,
Martin Vatev
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Vikas
Top achievements
Rank 1
answered on 11 Oct 2016, 04:35 PM

Hi Martin,

Thanks for the solution, this turns out to be too easy.  I will try it out in my real application.

One question, If i understand correctly datafilter only cares about the meta data (property names, type), Why is there no way to just a type to datafilter something like this <datafilter, source1={x:type local.employee}/>

Thanks

0
Martin
Telerik team
answered on 14 Oct 2016, 07:37 AM
Hello Vikas,

This solution is just a workaround and is not fully tested but it seems that it will work correctly. RadDataFilter is not designed to work in the presented scenario. For that reason, I try to find for you some workaround. 
The control is created to work in two modes. One of them is to communicate(bound) with any kind of collections (even a plain IEnumerable). The control can then be bound to any ItemsControls (GridView, TreeListView, ComboBox, TreeView etc.) to the filtered endpoint called FilteredSource.
The second one is the scenarios in which you might want to use RadDataFilter only for its UI without passing any data to it. These scenarios will require you to use the RadDataFilter's Unbound Mode feature. The usage of this feature consists of manually setting some of the RadDataFilter's properties and handling events. 

Unfortunately, none of the two approaches will do your job, so I tried to find for you some workaround which seems to work.

Please give it a try and update me if you notice any issues.

Regards,
Martin Vatev
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
DataFilter
Asked by
Vikas
Top achievements
Rank 1
Answers by
Martin
Telerik team
Vikas
Top achievements
Rank 1
Share this question
or