update code

pull/1540/head
sight 2024-01-10 09:03:33 +08:00
parent e52c605fe1
commit 18d238e9f5
1 changed files with 6 additions and 6 deletions

View File

@ -1908,13 +1908,13 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
var that = this; var that = this;
var ELEM_CELL = '.layui-table-cell'; var ELEM_CELL = '.layui-table-cell';
var opts = layui.type(opts) === 'array' ? opts : [opts]; var opts = layui.type(opts) === 'array' ? opts : [opts];
var dataCache = table.cache[that.key] || [];
var update = function(opt){ var update = function(opt){
var index = opt.index; var index = opt.index;
var row = opt.row; var row = opt.row;
var related = opt.related; var related = opt.related;
var dataCache = table.cache[that.key] || [];
var data = dataCache[index] || {}; var data = dataCache[index] || {};
var tr = that.layBody.find('tr[data-index="' + index + '"]'); var tr = that.layBody.find('tr[data-index="' + index + '"]');
layui.each(row, function (key, value) { layui.each(row, function (key, value) {
@ -1933,7 +1933,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
content: value, content: value,
tplData: $.extend({ tplData: $.extend({
LAY_COL: item3, LAY_COL: item3,
},data) }, data)
})); }));
td.data("content", value); td.data("content", value);
} }
@ -1948,7 +1948,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
content: content, content: content,
tplData: $.extend({ tplData: $.extend({
LAY_COL: item3, LAY_COL: item3,
},data) }, data)
})); }));
thisTd.data("content", content); thisTd.data("content", content);
} }
@ -1959,12 +1959,12 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
} }
layui.each(opts, function(i, opt){ layui.each(opts, function(i, opt){
update(opt) update(opt);
}); });
}; };
/** /**
* 更新 * 更新指定
* @param {string} id - table ID * @param {string} id - table ID
* @param {updateRowOptions | updateRowOptions[]} options * @param {updateRowOptions | updateRowOptions[]} options
*/ */
@ -2320,7 +2320,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
index: index, index: index,
row: fields, row: fields,
related: related related: related
}, function(key,value){ }, function(key, value){
obj.data[key] = value; obj.data[key] = value;
}); });
}, },