How can I influence the drop down filters so that both start with the operator 'Contains' and the logic between them as 'or'.
They should be able to change them after initial setting. i would like it to look like the enclosed image to start.
1 Answer, 1 is accepted
0
Eyup
Telerik team
answered on 27 Aug 2025, 02:13 PM
Hi David,
Thank you for reaching out.
To set both dropdown filter operators to 'Contains' and the logic between them to 'or' in the Telerik UI Grid filter menu, you can use the FilterMenuInit event. This approach will set the initial state as you described, while still allowing users to change the operators and logic afterward.
Steps to Achieve This:
Handle the FilterMenuInit event of the Grid.
In the event handler, set both filter operator dropdowns to 'Contains'.
Set the logic dropdown to 'or'.
Users can still change these values after the menu opens.
Sample Implementation:
functiononFilterMenuInit(e) {
var container = e.container;
// Set both filter operators to 'contains'
container.find("[data-role='dropdownlist']").each(function(index) {
var dropdown = $(this).data("kendoDropDownList");
// The first two dropdowns are for operatorsif (dropdown && index < 2) {
dropdown.value("contains");
}
});
// Set the logic dropdown (usually the third dropdown) to 'or'var logicDropDown = container.find("[data-role='dropdownlist']").eq(2).data("kendoDropDownList");
if (logicDropDown) {
logicDropDown.value("or");
}
}
Key Points:
This code sets the default operators and logic only when the filter menu is opened.
Users can still modify the operator and logic dropdowns after the initial setting.
If you have custom filter UI or more complex filter menus, you may need to adjust the selector logic for the dropdowns.