简体   繁体   English

如何在 Kendo UI Grid 中修改过滤器?

[英]How to modify Filter in Kendo UI Grid?

I have a Kendo Grid with its default Filter, and I would like to bring a litte modification.我有一个带有默认过滤器的 Kendo Grid,我想进行一些修改。

在此处输入图片说明

In drop down list we have different restrictions, ('Starts with','Contains' etc).在下拉列表中,我们有不同的限制,('Starts with'、'Contains' 等)。
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!谢谢!

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 .对于专注于文本字段,您可以使用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 .首先,您需要为过滤器选择KendoWidget - kendoPopup After that you bind function on event which fired after popup is fully load - activate event.之后,您将在弹出完全加载后activate事件上绑定函数 - activate事件。 And in function you update control state as you need.在函数中,您可以根据需要更新控制状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM