当前位置: 代码迷 >> 综合 >> 全选操作 easyui datagrid 让某行复选框不能选且getChecked获取不到该行值
  详细解决方案

全选操作 easyui datagrid 让某行复选框不能选且getChecked获取不到该行值

热度:11   发布时间:2024-01-26 16:03:06.0
onLoadSuccess: function (data) {
//数据加载前,将所有符合条件的checkbox置灰
//但是此置灰,在点击全选,调用getChecked方法时,仍可以获取到置灰的值
//所以需要在全选的时候做取消选择此行if(data){$.each(data.rows, function(index, item){if(item.payState != '3' && item.payState != '1' ){$("input[type='checkbox']")[index + 1].disabled = true;}if(item.packNo != null){$("input[type='checkbox']")[index + 1].disabled = true;}});}
},
onCheckAll:function (rows) {$.each(rows,function (index,item) {if(item.payState != '3' && item.payState != '1' ){$($("input[type='checkbox']")[index + 1]).prop("checked",false);$("#selfDataGrid").datagrid('unselectRow', index);}if(item.packNo != null ){$($("input[type='checkbox']")[index + 1]).prop("checked",false);$("#selfDataGrid").datagrid('unselectRow', index);}})
}
  相关解决方案