2
votes

I have a Kendo Grid with its default Filter, and I would like to bring a litte modification.

enter image description here

In drop down list we have different restrictions, ('Starts with','Contains' etc).
And what I want is:

  1. To set 'selected' for 'Contains' by default
  2. On load put focus in input box just under dropdown list.

Thank you!

1

1 Answers

1
votes

For make some operator default you should just change order in filter options:

filterable: {
                        extra: false,
                        operators: {
                            string: {
                                contains: "Contains"
                                eq: "Is equal to",
                                neq: "Is not equal to"
                            }
                        }
                    }

And for focus on text field you can use filterMenueInit Event. It will look like this for your case:

filterMenuInit: function(e) {
    var popup = e.container.data("kendoPopup");
    popup.bind("activate", function (e) {
        this.element.find("input").focus();
    });
}

First you need to select KendoWidget for filter - kendoPopup. After that you bind function on event which fired after popup is fully load - activate event. And in function you update control state as you need.