jqGrid: How to use multiselect on different pages

给你一囗甜甜゛ 提交于 2019-11-30 07:26:27

Right, jqGrid will only select rows on the current page. In order to select other rows you need to maintain a list of selected ID's and manually select them.

To do this you need to add code to your loadComplete event to search the current page and select any of these rows:

var ids = grid.jqGrid('getDataIDs');
for (var i = 0; i < ids.length; i++){
    if (selected[ids[i]] === true ){
        grid.setSelection(ids[i], false);
    }
}

You also need to add code to your onSelectRow and onSelectAll events to adjust the contents of selected when the user selects/unselects rows:

onSelectRow: function(rowid, status){
    selected[rowid] = status;
    setSelectedDeviceCount();
},

onSelectAll: function(rowids, status){
    for (var i = 0; i < rowids.length; i++){
        selected[rowids[i]] = status;
    }
}

Does that help?

Grubsnik

Please see this: https://stackoverflow.com/a/24941828/136219

For a way to achieve what you are looking for.

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