set defaults for grid filters drop down

1 Answer 6 Views
Grid
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
David Ocasio asked on 27 Aug 2025, 12:46 PM

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

Sort by
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:

function onFilterMenuInit(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 operators
        if (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.

For more details, you can also check:

Please check the provided directions and let me know if you find them helpful.

 

    Regards,
    Eyup
    Progress Telerik

    Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

    Tags
    Grid
    Asked by
    David Ocasio
    Top achievements
    Rank 2
    Iron
    Veteran
    Iron
    Answers by
    Eyup
    Telerik team
    Share this question
    or