Here is the scenario:
1. Select all rows by checking the header row checkbox. 2. Unselect one row. 3. The header row checkbox 开发者_StackOverflow中文版is still checked which is invalid because not all rows are selected.
How can I unselect the hedaer row checkbox? Thanks
You can use resetSelection method. Look at the example prepared for this and this question. The button "Clear Selection" use resetSelection method.
You can do the following:
var grid = $("#ID_OF_YOUR_GRID");
grid.jqGrid({
//other options
multiselect: true,
onSelectRow: function (rowid, status) {
var chkSelectAll = $("#ID_OF_THE_HEADER_CHECKBOX_USUALLY_CB_DATA");
if (chkSelectAll.length && chkSelectAll.is(':checked') && !status) {
chkSelectAll.removeAttr('checked');
}
}
});
BTW. You only need this on the older versions of JQGrid. I've checked in version 4.3.1 this works out of the box.
精彩评论