jQuery(\"#grid\").jqGrid({
url:call_url,
datatype: \"json\",
height: \'auto\',
rowNum: 20,
rowList: [20,30,40],
colNames:[
If you use jqGrid 4.6 with datatype: "json"
and no loadonce: true
option then you have not so much possibilities. You have to enumerate all multiselect checkboxes of the grid and select there. So you can do
$("#cb_grid").click(); // "grid" is the grid id
inside of loadComplete
callback for example. If you would think about all cases you will probably add more additional criteria, because loadComplete
will be called on sorting, paging and so on.
UPDATED: You code have $('.cbox').attr('checked', true);
line inside of rowattr
. In the way you don't change the checkbox of the row, which is not yet exist. Instead of that you set checked
attribute with wrong value true
instead of "checked"
on the checkbox of the column header. You should remove the line to be able to use the code which I suggested you:
loadComplete: function () {
$("#cb_" + this.id).click();
},
rowattr: function (item, rd, rowid) {
//$('.cbox').attr('checked', true);
if (parseInt(rowid) === 10) {
return {"class": "ui-state-disabled ui-jqgrid-disablePointerEvents"};
}
},
beforeSelectRow: function (rowid, e) {
if ($(e.target).closest("tr.jqgrow").hasClass("ui-state-disabled")) {
return false; // not allow select the row
}
return true; // allow select the row
}
see the demo: http://jsfiddle.net/OlegKi/aagxejj5/4/