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

Kendo React Grid Custom Filter based on a reference data

3 Answers 1909 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Arun
Top achievements
Rank 1
Arun asked on 23 Jan 2020, 09:35 AM

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.

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 23 Jan 2020, 11:53 AM

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
0
Arun
Top achievements
Rank 1
answered on 23 Jan 2020, 12:41 PM

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.

0
Stefan
Telerik team
answered on 24 Jan 2020, 12:59 PM

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
Tags
General Discussions
Asked by
Arun
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Arun
Top achievements
Rank 1
Share this question
or