处理默认勾选问题

This commit is contained in:
WenG 2020-09-08 17:11:51 +08:00
parent 022ecc2c0a
commit fe0a85b1cd

View File

@ -52,6 +52,14 @@
var newSelectedUserList = [];
var tableData = [];
// 初始化选择列表
function initNewSelectedUserList() {
for(var i = 0, item; item = oldSelectedUserList[i++];) {
newSelectedUserList.push(item);
}
}
initNewSelectedUserList();
// 初始化表格
function initTable() {
$.extend(table, {config: {checkName: 'checked'}});
@ -112,12 +120,12 @@
page: true,
parseData: function(data) {
for(var i = 0, item; item = data.rows[i++];) {
if(!oldSelectedUserList) {
if(!newSelectedUserList) {
item.checked = false;
continue;
}
var isSelected = false;
for(var j = 0, jItem; jItem = oldSelectedUserList[j++];) {
for(var j = 0, jItem; jItem = newSelectedUserList[j++];) {
if(item.userId === jItem.userId) {
isSelected = true;
break;