function initTable() { $('#dataTable').datagrid({ url: rootUrl + 'SensorAlarm/sensor_alarm/GetDataList', method: 'POST', //queryParams: { }, idField: 'Id', fit: true, fitColumns: true, scrollbarSize: 0, remoteSort: false, singleSelect: false, selectOnCheck: false, checkOnSelect: false,//----单击行选中不起作用则需要写js事件onClickRow-----// //sortName: 'Id', //sortOrder: 'asc', //rownumbers: true, pagination: true, pageSize: 30, //nowrap: false, pageList: [10, 20, 30, 50, 100, 150, 200], //showFooter: true, columns: [[ { title: 'ck', field: 'ck', checkbox: true }, ]], onBeforeLoad: function (param) { }, onBeforeSelect: function () { return false; }, onClickRow: function (index, row) { var selected = $("#dataTable").datagrid("getChecked"); var thebool = true; if (selected.length > 0) { for (var i = 0; i < selected.length; i++) { if (selected[i]['Id'] == row['Id']) { thebool = false;
//这里没有写 return跳出有其他处理需求
} } } else { $('#dataTable').datagrid('checkRow', index); } if (thebool) { $('#dataTable').datagrid('checkRow', index); } else { $('#dataTable').datagrid('uncheckRow', index); } } }); }