jqgrid multiselect filter issue with grid refresh

我是研究僧i 提交于 2019-12-18 07:04:31

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/26944778/jqgrid-multiselect-filter-issue-with-grid-refresh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!