easyui的combotree之模糊过滤

来源:互联网 发布:tensorflow下载地址 编辑:程序博客网 时间:2024/06/02 03:34
不想说了,直接上代码
$(document).ready(function () {        $("#item").combotree({            url: '../../Handler/DetectLine/GetDetStaTreeDataHandler.ashx',              valueField: 'id',            textField: 'text',            editable: true,            keyHandler: {                enter: function () {                    var q = $('#item).combotree('getText');                    var t = $(this).combotree('tree');                    var nodes = t.tree('getChildren');                    for (var i = 0; i < nodes.length; i++) {                        var node = nodes[i];                        if (node.text.indexOf(q) >= 0) {                            $(node.target).show();                        } else {                            $(node.target).hide();                        }                    }                    var opts = $(this).combotree('options');                    if (!opts.hasSetEvents) {                        opts.hasSetEvents = true;                        var onShowPanel = opts.onShowPanel;                        opts.onShowPanel = function () {                            var nodes = t.tree('getChildren');                            for (var i = 0; i < nodes.length; i++) {                                $(nodes[i].target).show();                            }                            onShowPanel.call(this);                        };                        $(this).combo('options').onShowPanel = opts.onShowPanel;                    }                }            }        });    });

0 0
原创粉丝点击