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

Data Tools - Filter - EnumFilter

5 Answers 173 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 21 Apr 2021, 02:41 PM

I would like to use the EnumFilter in the Data Tools Filter component and I'm not sure how to populate it. Are there any examples of this in use?

Thanks,

 

Richard.

5 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 22 Apr 2021, 05:57 AM

Hello, Richard,

I made an example where the Filter component uses a custom ComboBox component bound to data objects:

https://stackblitz.com/edit/react-cdseqi-jd7qw4?file=app/main.jsx

On the onChange event, the developer can choose which field from the object to use as a filter value:

  const onChange = event => {
    props.onFilterChange.call(undefined, {
      nextFilter: { ...props.filter, value: event.target.value.ProductName }

I hope this is helpful.

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Richard
Top achievements
Rank 1
answered on 22 Apr 2021, 02:47 PM

Thank you, Stefan. That really helped.

 

Just curious though that you created a custom filter and didn't actually use the EnumFilter. What is the purpose of the EnumFilter then?

0
Richard
Top achievements
Rank 1
answered on 22 Apr 2021, 02:57 PM
One other question, how would I go about setting the initial value?
0
Accepted
Stefan
Telerik team
answered on 23 Apr 2021, 04:42 AM

Hello, Richard,

The initial value will be based on the initial filter for that field.

As this is a complex object, we will need to find the object that that value and passes it to the ComboBox.

I updated the example to showcase this:

https://stackblitz.com/edit/react-cdseqi-wtkqvg?file=app/main.jsx

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Richard
Top achievements
Rank 1
answered on 23 Apr 2021, 01:05 PM
Thank you again Stefan! That's exactly what I was looking for!
Tags
General Discussions
Asked by
Richard
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Richard
Top achievements
Rank 1
Share this question
or