jqgrid multiselect only selects rows on the current page, if paging is enabled. How to make it select rows across pages?

前端 未结 2 902
情话喂你
情话喂你 2020-12-30 12:12

I noticed in the jqgrid demo (http://www.trirand.com/blog/jqgrid/jqgrid.html > Advanced > Multiselect) that only rows (visible) on the current page are selected if paging is

2条回答
  •  粉色の甜心
    2020-12-30 12:57

    I know this question is kind of dusty, but I recently had a need for this functionality and found what I consider a much more clean way to do it.

    Instead of attaching an event to each checkbox, why not use the onSelectRow and onSelectAll events of the jqGrid? When a row is selected, check if our list of selected rows includes this row (based on id). Add it to the list if it was not there and has been selected, remove it if it was there and is no longer selected. If all rows are selected, iterate through them.

    var $grid  = jQuery("#myGrid");
    var updateIdsOfSelectedRows = function (id, isSelected) {
        var contains = idsOfSelectedRows.contains(id);
        if (!isSelected && contains) {
            for(var i=0; i

    Hope this helps others looking for a solution.

提交回复
热议问题