Event before the grid is filtered

4 posts, 0 answers
  1. Vikas
    Vikas avatar
    36 posts
    Member since:
    Dec 2015

    Posted 06 Oct Link to this post

    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

  2. Martin Vatev
    Admin
    Martin Vatev avatar
    90 posts

    Posted 11 Oct Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Vikas
    Vikas avatar
    36 posts
    Member since:
    Dec 2015

    Posted 11 Oct in reply to Martin Vatev Link to this post

    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

  5. Martin Vatev
    Admin
    Martin Vatev avatar
    90 posts

    Posted 14 Oct Link to this post

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