使用jqgrid並使用multiSelect="true"
選項。我禁用行和防止基於一些標誌地位的選擇下面基於IS_FLAGGEd = 1
jqgrid - 禁用標題複選框(多選)= true,如果所有行都禁用
//disable row which are flagged
rowattr: function (item) {
if (parseInt(item.IS_FLAGGED) == 1) {
return {"class": "ui-state-disabled ui-jqgrid-disablePointerEvents"};
}
},
//prevent selection of disabled rows
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
}
要禁用頭複選框,下面的代碼實現
禁用行(S)作爲被提及,但它會禁用頭檢查即使一行被禁用也是如此。
//disable header checkbox only if all rows are disabled
loadComplete: function() {
var grid = $("#grid");
var ids = grid.jqGrid('getDataIDs');
for(var i=0;i < ids.length;i++){
var rowId = ids[i];
var rowData = jQuery('#grid').jqGrid ('getRowData', rowId);
console.log(rowData.SUBMIT_TO_ACC);
if(rowData.FLAG_STATUS == 1){
$('tr.ui-jqgrid-labels').addClass('ui-state-disabled ui-jqgrid-disablePointerEvents');
}
}
}
如何禁用頭複選框(multiselect = true)
,只有當ALL
行被禁用即hasClass(ui-state-disabled)
?
jqGrid的版本= 4.6
jQuery的版本= 1.7.2