简体   繁体   English

剑道comboBox完成过滤后如何触发事件

[英]How to fire an event after a kendo comboBox has finished a filter

I need to fire an event after my combo box finishes its filter 我的组合框完成过滤后,我需要触发一个事件

I have extended the widget and have tried to chuck a .done on the end of the call. 我扩展了小部件,并尝试在通话结束时删除.done。

    search: function(word) {
        word = typeof word === "string" ? word : this.text();
        var that = this,
            length = word.length,
            options = that.options,
            ignoreCase = options.ignoreCase,
            filter = options.filter,
            field = options.dataTextField;

        clearTimeout(that._typing);

        if (length >= options.minLength) {
            that._state = STATE_FILTER;
            if (filter === "none") {
                that._filter(word);
            } else {
                that._open = true;
                that._filterSource({
                    value: ignoreCase ? word.toLowerCase() : word,
                    field: field,
                    operator: filter,
                    ignoreCase: ignoreCase
                }); // .done here does not work :(
            }
        }
    },

I need to know when a value is returned so that I can do some other stuff on my page once i know that the input matches a value server side. 我需要知道何时返回值,以便一旦知道输入与值服务器端匹配就可以在页面上做其他事情。

Can anybody think of a way to achieve this? 有人能想到实现这一目标的方法吗? :) :)

Is there a way to fire an event once the datasource has changed? 一旦数据源更改,是否有办法触发事件?

I solved the issue by using the _busy state on the widget. 我通过在小部件上使用_busy状态解决了该问题。 The following code is in the select function on the widget so whenever someone losses focus this fires. 以下代码位于小部件上的select函数中,因此,只要有人失去焦点,就会触发该事件。

If the widget is not busy it will have finished the ajax call. 如果窗口小部件不忙,它将完成ajax调用。 Hope this is usefull to someone :) 希望这对某人有用:)

    if (data && data.length != 0) 
    {
        for (var i = 0; i < data.length; i++) 
        {
            li = $(that.ul).find('li:nth-child(' + (i + 1) + ')');
            if (li.length != 0 && data[i].ProductCode == that.input.val()) 
            {
                that._select(li);
                return;
            }
        }
    }
    if (that._busy && that._busy != null)
    {
        that.busyCheck = setInterval(function () {
            if (!that._busy || that._busy == null) {
                clearInterval(that.busyCheck);
                if (data && data.length != 0){
                    for (var i = 0; i < data.length; i++){
                        li = $(that.ul).find('li:nth-child(' + (i + 1) + ')');
                        if (li.length != 0 && data[i].ProductCode == that.input.val()){
                            that._select(li);
                            return;
                        }
                    }
                }
            }
        }, 50);
    } 
    that._AddcodeIsServerValid(false);

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

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