Please export the operatorsMap from Data Query's filter-no-eval.js.
If exporting the operators map is not an option, consider introducing an enum which defines the operators as constants:
export enum Operators {
contains = 'contains',
doesnotcontain = 'doesnotcontain',
doesnotendwith = 'doesnotendwith',
doesnotstartwith = 'doesnotstartwith',
endswith = 'endswith',
eq = 'eq',
gt = 'gt',
gte = 'gte',
isempty = 'isempty',
isnotempty = 'isnotempty',
isnotnull = 'isnotnull',
isnull = 'isnull',
lt = 'lt',
lte = 'lte',
neq = 'neq',
startswith = 'startswith'
}
Hi,
The FilterOperator enum is available in v.1.6.0 of the @progress/kendo-data-query package.
Regards,
Dimiter Topalov
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/.
Hi Russell,
Thank you for the provided details. I changed the type of this thread to a public feature request, visible on our Feedback portal so that other members of the community can support and comment it.
We will track the customer demand, and will consider exposing a type-checking mechanism for the FilterDescriptor operators.
Regards,
Dimiter Topalov
Progress Telerik
Dimiter,
Thanks for your reply. Here is an example code snippet which sets the default gridState on initial loading of a kendo grid.
Here, I am using an enum which duplicates the contents of the operatorsMap. I believe this should be built-in.
Having easy access to this info at compile time would also make it easier to make sure these operators are supported in server-side grid processing code.
export enum KendoOperators {
contains = 'contains',
doesnotcontain = 'doesnotcontain',
doesnotendwith = 'doesnotendwith',
doesnotstartwith = 'doesnotstartwith',
endswith = 'endswith',
eq = 'eq',
gt = 'gt',
gte = 'gte',
isempty = 'isempty',
isnotempty = 'isnotempty',
isnotnull = 'isnotnull',
isnull = 'isnull',
lt = 'lt',
lte = 'lte',
neq = 'neq',
startswith = 'startswith'
}
gridState: {
sort: [
{field: 'definition.shortName', dir: 'asc'}
],
filter: {
filters: [
{
operator: KendoOperators.eq,
field: 'includeOverrides',
value: true
},
{
operator: KendoOperators.eq,
field: 'includeDefaults',
value: false
}
],
logic: 'and'
}
}
Hello Russell,
Could you please explain in further details what would you like to use the operatorsMap from the source code for, so we can consider exposing it or suggesting an alternative approach for achieving the desired result? Thank you in advance.
Regards,
Dimiter Topalov
Progress Telerik