zoukankan      html  css  js  c++  java
  • EasyUI combobox

    高度自适应

    data-options="required:true,editable:false,panelHeight:'auto',panelMaxHeight:170"
    加上panelHeight:'auto'即可

    取值问题

    例子:<select id="cc" class="easyui-combobox" name="cc" >在对其取值的时候?
    //不能使用
        $('#cc').val()
    //正确应该
    //取ID
        $('#cc').combobox('getValue')
    //取显示的name
        $('#cc').combobox('getText')
    
    

    模糊查询

    若要模糊查找,就要把jquery.easyui.js文件row[opts.textField].indexOf(q)==0替换为row[opts.textField].indexOf(q)>-1,或者 添加 filter: function(q, row){ var opts = $(this).combobox('options'); return row[opts.textField].indexOf(q) == 0; }。
    修改事件keydown.combo为keyup.combo就能支持火狐的中文模糊搜索。
    以上是网上的说法,我的是1.4.3版本

    1、调整Combobox支持模糊查询,并支持从任意位置开始匹配
                return row[opts.textField].toLowerCase().indexOf(q.toLowerCase()) == 0;
      修改为
              return row[opts.textField].toLowerCase().indexOf(q.toLowerCase()) > -1;


    2、调整Combobox,以支持搜索时中文输入结束不自动触发查询

     解决方案:将触发查询执行的引起事件由keydown改成 keyup

        $.fn.combo.defaults = $.extend({}, $.fn.textbox.defaults, {
            inputEvents: { click: _952, keydown: _956, paste: _956, drop: _956 }, panelWidth: null, panelHeight: 200, panelMinWidth: null, panelMaxWidth: null, panelMinHeight: null, panelMaxHeight: null, panelAlign: "left", multiple: false, selectOnNavigation: true, separator: ",", hasDownArrow: true, delay: 200, keyHandler: {
                up: function (e) {
                }, down: function (e) {
                }, left: function (e) {
                }, right: function (e) {
                }, enter: function (e) {
                }, query: function (q, e) {
                }
            }, onShowPanel: function () {
            }, onHidePanel: function () {
            }, onChange: function (_983, _984) {
            }
        });

    修改为

        $.fn.combo.defaults = $.extend({}, $.fn.textbox.defaults, {
            inputEvents: { click: _952, keyup: _956, paste: _956, drop: _956 }, panelWidth: null, panelHeight: 200, panelMinWidth: null, panelMaxWidth: null, panelMinHeight: null, panelMaxHeight: null, panelAlign: "left", multiple: false, selectOnNavigation: true, separator: ",", hasDownArrow: true, delay: 200, keyHandler: {
                up: function (e) {
                }, down: function (e) {
                }, left: function (e) {
                }, right: function (e) {
                }, enter: function (e) {
                }, query: function (q, e) {
                }
            }, onShowPanel: function () {
            }, onHidePanel: function () {
            }, onChange: function (_983, _984) {
            }
        });
    3.调整Combobox,以支持搜索时中文输入法输英文结束时带回车按钮不自动触发查询
            switch (e.keyCode) {
                case 38:
                    opts.keyHandler.up.call(_957, e);
                    break;
                case 40:
                    opts.keyHandler.down.call(_957, e);
                    break;
                case 37:
                    opts.keyHandler.left.call(_957, e);
                    break;
                case 39:
                    opts.keyHandler.right.call(_957, e);
                    break;
                case 13:
                    e.preventDefault();
                    opts.keyHandler.enter.call(_957, e);
                    return false;
                case 9:
                case 27:
                    _950(_957);
                    break;
                default:
                    if (opts.editable) {
                        if (_958.timer) {
                            clearTimeout(_958.timer);
                        }
                        _958.timer = setTimeout(function () {
                            var q = t.combo("getText");
                            if (_958.previousText != q) {
                                _958.previousText = q;
                                t.combo("showPanel");
                                opts.keyHandler.query.call(_957, q, e);
                                t.combo("validate");
                            }
                        }, opts.delay);
                    }
            }
    修改为
            switch (e.keyCode) {
                case 38:
                    opts.keyHandler.up.call(_957, e);
                    break;
                case 40:
                    opts.keyHandler.down.call(_957, e);
                    break;
                case 37:
                    opts.keyHandler.left.call(_957, e);
                    break;
                case 39:
                    opts.keyHandler.right.call(_957, e);
                    break;
                case 13:
                    e.preventDefault();
                    if (opts.editable) {
                        if (_958.timer) {
                            clearTimeout(_958.timer);
                        }
                        _958.timer = setTimeout(function () {
                            var q = t.combo("getText");
                            if (_958.previousText != q) {
                                _958.previousText = q;
                                t.combo("showPanel");
                                opts.keyHandler.query.call(_957, q, e);
                                t.combo("validate");
                            }
                        }, opts.delay);
                    }
                    //opts.keyHandler.enter.call(_957, e);
                    return false;
                case 9:
                case 27:
                    _950(_957);
                    break;
                default:
                    if (opts.editable) {
                        if (_958.timer) {
                            clearTimeout(_958.timer);
                        }
                        _958.timer = setTimeout(function () {
                            var q = t.combo("getText");
                            if (_958.previousText != q) {
                                _958.previousText = q;
                                t.combo("showPanel");
                                opts.keyHandler.query.call(_957, q, e);
                                t.combo("validate");
                            }
                        }, opts.delay);
                    }
            }
  • 相关阅读:
    OnEraseBkgnd、OnPaint与画面重绘
    .编译ADO类DLL时报错的解决方案
    VC列表框样式
    Codeforces 131D. Subway 寻找环树的最短路径
    Codeforces 103B. Cthulhu 寻找奈亚子
    Codeforces 246D. Colorful Graph
    Codeforces 278C. Learning Languages 图的遍历
    Codeforces 217A. Ice Skating 搜索
    Codeforces 107A. Dorm Water Supply 搜图
    Codeforces 263 D. Cycle in Graph 环
  • 原文地址:https://www.cnblogs.com/ccccc05/p/6213971.html
Copyright © 2011-2022 走看看