Kendo React Grid Custom Filter based on a reference data

4 posts, 0 answers
  1. Arun
    Arun avatar
    36 posts
    Member since:
    Feb 2019

    Posted 23 Jan 2020 Link to this post

    Hi, I have a grid which displays the state names in a column. I want to have a filter on that column that will filter based on the state code. The state code comes from a reference data. Please advice.

     

    Below is my stackblitz link:

     

    https://stackblitz.com/edit/react-byhjeb-oe3mkm

     

    If I type in "md", maryland and states which startswith 'md' should be filtered.

  2. Stefan
    Admin
    Stefan avatar
    3008 posts

    Posted 23 Jan 2020 Link to this post

    Hello, Arun,

    Thank you for your example.

    As the Grid filter row can work only with a single filter per column, I can suggest adding the second filter just before rendering.

    This can be achieved by taking the filter value to see if it matches the reference data and if it does to add an extra filter field.

    I updated the example to showcase this:

    https://stackblitz.com/edit/react-byhjeb-xf7lc5?file=app%2Fmain.jsx

    I hope this is helpful.

    Regards,
    Stefan
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Arun
    Arun avatar
    36 posts
    Member since:
    Feb 2019

    Posted 23 Jan 2020 Link to this post

    Hi Stefan,

     

    thank you for the example. It works as expected. But if I try to filter on other columns, it fails. Can we add this filter Functionality only for the particular column? Please advice.

  4. Stefan
    Admin
    Stefan avatar
    3008 posts

    Posted 24 Jan 2020 Link to this post

    Hello, Arun,

    I tested the example when filtering by another column and it was working as expected.

    As the filter logic is or this will filter data if the name is "Maryland" or the ID is 3.

    Let me know if I missed something.

    Regards,
    Stefan
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top