Hi team,
Working with complex or even slightly nested CompositeFilterDescriptors gets confusing quick, does KendoReact contain any kind of helpers for managing a filter tree, adding, updating or removeing Composite/FilterDescriptors?
My usecase is that i need to build a composite filter desc where filters contaisn a mix of FilterDescriptor and CompositeFilterDescriptor, and im hanving trouble maintianing such an object, hence the question.
eg:
// All search mechanisms are external to the Grid component
// eg: https://www.telerik.com/kendo-react-ui/components/grid/filtering/advanced-filtering#filtering-data-grid-through-external-textbox
{
logic: 'and',
filters: [
// This CompFiltDesc is controlled by a single 'Product Search' box, the goal is to find any record where
// ther code or description contains any of the text, so 'mix chef' and 'checf mix' return the same thing
{
logic: 'or',
filters: [
{ field: 'productItem.description', operator: 'contains', value: 'chef' },
{ field: 'productItem.code', operator: 'contains', value: 'chef' },
{ field: 'productItem.description', operator: 'contains', value: 'mix' },
{ field: 'productItem.code', operator: 'contains', value: 'mix' }
]
},
{
field: 'quantity', operator: 'isnotnull'
},
{
field: 'productItem.attributes', operator: 'contains', value: 'Brand:x'
}
]
}THanks,
Grant
Hi, Grant,
KendoReact does not include built-in helper utilities specifically for managing, adding, updating, or removing FilterDescriptor and CompositeFilterDescriptor objects within a filter tree. This means that working with complex or nested filters requires manual management in the code.
Could you share more about the specific difficulties you’re facing when maintaining these filter objects? For example, are you having trouble with recursion, deduplication, or keeping filter state in sync across components? With more details, I can provide more targeted code samples or strategies.
Regards,
Filip
Hi Filip,
Thanks for clarifying. The trouble is mostly down to mangement on the filter object. Some of my filter objects are not managed by the Grid (or other component) and need to be manully updated as criteria change. Looking at my example, I was hoping that kendo had some helpers to traverse the tree to find filters by field/value, add/update filters or remove filters by field. This would make it easier for me to manage many instances like this.
Its no trouble now though. With some AI help I've fleshed out a few CRUD-like helpers and will be sharing them soon.
- Grant
Hi, Grant,
Thank you for the provided clarification. While currently the Grid does not have such helpers I have opened an official feature request for having this functionality out of the box:
https://feedback.telerik.com/kendo-react-ui/1702491-add-filter-utilities
I have also added your vote.
Regards,
Filip