码迷,mamicode.com
首页 > 其他好文 > 详细

ligerui 高级自定义查询

时间:2015-09-01 13:50:58      阅读:2633      评论:0      收藏:0      [点我收藏+]

标签:

//扩展 ligerGrid 的 搜索功能(高级自定义查询).应用: demos/filter/grid.htm
        $.ligerui.controls.Grid.prototype.showFilter = function () {

            var g = this, p = this.options;
            if (g.winfilter) {
                g.winfilter.show();
                return;
            }
            var filtercontainer = $(‘<div id="‘ + g.id + ‘_filtercontainer"></div>‘).width(380).height(120).hide();
            var filter = filtercontainer.ligerFilter({ fields: getFields() });
            return g.winfilter = $.ligerDialog.open({
                width: 420, height: 208,
                target: filtercontainer, isResize: true, top: 50,
                buttons: [
                    { text: ‘确定‘, onclick: function (item, dialog) { loadData(); dialog.hide(); } },
                    { text: ‘取消‘, onclick: function (item, dialog) { dialog.hide(); } }
                ]
            });

            //将grid的columns转换为filter的fields
            function getFields() {
                var fields = [];
                //如果是多表头,那么g.columns为最低级的列
                $(g.columns).each(function () {
                    var o = { name: this.name, display: this.display };
                    var isNumber = this.type == "int" || this.type == "number" || this.type == "float";
                    var isDate = this.type == "date";
                    if (isNumber) o.type = "number";
                    if (isDate) o.type = "date";
                    if (this.editor) {
                        o.editor = this.editor;
                    }
                    fields.push(o);
                });
                return fields;
            }

            function loadData() {
                var data = filter.getData();
                alert(data);
            }


        };
需要自己修改

 

ligerui 高级自定义查询

标签:

原文地址:http://www.cnblogs.com/jiecaoge/p/4775348.html

(5)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!