Hi team,
A customer which uses Kendo grids has asked us to improve the default string column filter which has two fields and one boolean operand and now they want three fields (with their usual "eq", "contains"...) and two boolean operands ("and" and "or" are fine) in the same column.
I am having a bit of a hard time finding an example that manipulates the same column with three fields because everything I stumble upon uses two or three fields, either in different columns or in a templatized one.
My starting point is this code I found here and adapted to work in my local environment:
ds.filter([
{"logic":"or",
"filters":[
{
"field":"Freight",
"operator":"eq",
"value":11.61},
{
"field":"Freight",
"operator":"eq",
"value":51.3}
]},
{
"field":"ShipCity",
"operator":"startswith",
"value":"Char"}
]);
I have tried to figure out a way to use the third set of properties within the other two, to no avail.
Is there any way to achieve what I am trying to do?
Thank you very much in advance, best wishes.
Hello Juan,
I having difficulties determining the requirement. Could you please elaborate by giving more details?
Do you need to filter several columns with one query? Please note each column is bound to separate property.
I have examined the provided jsfiddle snippet and it seems good to me. I have transferred it to a Dojo where you can modify it to showcase the problem so I can better understand the case.
Regards,
Nikolay
I will try to clarify. The goal is to filter just one column with three text boxes but being able to use different logics at the same time. Let's see this example:
We will assume that the column contains plain text strings. Here I am using the query "(alarm title) contains Lorem AND Ipsum OR Consectetur". Therefore, it contains two logics. But I do not know if the logic order would be "(1 AND 2) OR 3" or "1 AND (2 OR 3)". The question can be summarized in that I do not know if I can include two different logics in the same column, like in this pseudocode:
{"logic1": "and"}, {"logic2": "or"}, {"filter": {"operator": "contains", "value": "Lorem"}}, {"filter": {"operator": "contains", "value": "Ipsum"}}, {"filter": {"operator": "contains", "value": "Consectetur"}}
Hope it is clearer now.
Regards,
Juan
Hi Juan,
This is possible with a custom login in the filterMenuInit event handler. The filtering can be performed by calling the filter() method of the dataSource. A runnable demo can be found in the following article:
Let me know if you have any questions.
Regards,
Nikolay