网格刷新的jqgrid多选过滤器问题 [英] jqgrid multiselect filter issue with grid refresh

查看:15
本文介绍了网格刷新的jqgrid多选过滤器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在检查 .我稍后会向 trirand 报告这个错误.

要解决这个问题,必须使用 filterToolbarbeforeClear 回调:

beforeClear: function () {$(this.grid.hDiv).find(".ui-search-toolbar .ui-search-input>select[多个] 选项").每个(函数(){//取消选择 <select> 中的所有选项this.selected = false;});$(this.grid.hDiv).find(".ui-search-toolbar button.ui-multiselect").每个(函数(){//将 jQuery UI 多选与 <select> 同步$(this).prev("select[multiple]").multiselect("refresh");}).css({宽度:98%",marginTop: "1px",marginBottom: "1px",paddingTop:3px"});}

演示演示了解决方法.如果 jqGrid 中的错误将得到解决,那么可以从 beforeClear 回调中删除第一行树,如 演示.

I was checking the demo to implement Multiselect filtering in my project.

It is a nice demo indeed but has some issues with it. Select a filter and hit the refresh button then filters are not resetting. And after that it will starts malfunctioning.

Select a filter:

After hitting refresh:

Filters are not resetting

Now unchecked the filter:

Got empty grid.

How can I fix these issues? Any Idea.

解决方案

Thank you for the bug report! There are a bug in clearToolbar in the lines of the code. I will report the bug later to trirand.

To fix the problem one have to use beforeClear callback of filterToolbar:

beforeClear: function () {
    $(this.grid.hDiv)
        .find(".ui-search-toolbar .ui-search-input>select[multiple] option")
        .each(function () {
            // unselect all options in <select>
            this.selected = false; 
        }
    );

    $(this.grid.hDiv)
        .find(".ui-search-toolbar button.ui-multiselect")
        .each(function () {
            // synchronize jQuery UI Multiselect with <select>
            $(this).prev("select[multiple]").multiselect("refresh");
        }
    ).css({
        width: "98%",
        marginTop: "1px",
        marginBottom: "1px",
        paddingTop: "3px"
    });
}

The demo demonstrates the workaround. If the bug in jqGrid will be solved then one could remove the first tree lines from the beforeClear callback like in the demo.

这篇关于网格刷新的jqgrid多选过滤器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆