Is there any way to implement more complex filtering with a customer GridFilterCell (https://www.telerik.com/kendo-react-ui/components/grid/api/GridFilterCell/) component?
Currently it fires an OnChange event to the column but can only pass one operation and value to the column, which I presume then translates that to a FilterDescriptor. But is there a way (or a plan on the roadmap) to just pass a FilterDescriptor instead, so one could create a custom FilterCell that returns rules of the type "this value OR this value".
The FilterDescriptor objects are quite flexible and powerful, but the GridFilterCell has no way to tap into that flexibility that I can currently see.
Examples would be things like making a GridFilterCell with a Toggle between MondayWednesdayFriday and TuesdayThursday for a field showing day of the week, or other different groups of values in an enum column. But currently You can only pass a single operation of Equals or Contains or Greater than, so you could pick an individual weekday, but not something more complicated like a "Hide Weekends" button.
11 Answers, 1 is accepted
Based on the provided details I can assume that the desired result is to pass more than one filter from a custom filter cell.
This can be achieved, by directly calling the method that filters the data with the programmatically built filter, instead of using the onChange event.
A similar approach is used in the following example:
https://stackblitz.com/edit/react-bjlym3?file=app%2FdropdownFilterCell.js
Please take a look and the example and advise if this is what's required to achieve the desired result.
Regards,
Stefan
Progress Telerik
I`m glad to hear that this will help at least to start the prototype.
If additional assistance is needed during the process please let me know, I will be happy to help.
Regards,
Stefan
Progress Telerik
We ran into some more issues related to trying to implement some more reusable custom filter cells. Mainly, we have to rewrite the logic for merging in the filters for each new data set we wish to use it on. Especially where we need to be able to filter multiple columns at once, this can get quite cumbersome and verbose.
From our perspective, it seems like it would make more sense to let the filterChange function take a full FilterDescriptor, as the library seems to already handle those quite easily and could probably save a lot of code and help make these components more reusable. We feel like an API change like that would greatly improve how these custom filter cells work.
Thank you for the recommendation.
I can suggest making a request in our feedback portal explaining how the filter change is expected for handle this. Then our developers will evaluate it to ensure that it will not affect to already implemented functionalities:
https://feedback.telerik.com/kendo-react-ui/
Regards,
Stefan
Progress Telerik
I started one here:
https://feedback.telerik.com/kendo-react-ui/1406756-allow-setting-compositefilterdescriptor-from-gridfiltercell
Thank you for sharing the request.
I have updated your Telerik points for posting this request.
Regards,
Stefan
Progress Telerik
In case anyone ends up here via searching, the custom filter cell can actually use a function with complex logic to achieve more nuanced filter behaviour. An example is shown here of the Value containing multiple fields and an operation function being defined instead of simple value and string:
https://www.telerik.com/kendo-react-ui/components/grid/filtering/#toc-custom-filter-cells
The Grid itself does not create your query, If you have some complex filter component, it will be needed to translate it to the query before making the request.
You can place anything in the filter cell and bypass the entire grid filter event and grid filter prop.
Regards,
Vasil
Progress Telerik