优化 table 局部代码排版

pull/1281/head
贤心 2023-06-12 14:58:52 +08:00
parent 261b27a44b
commit b3c19e064d
1 changed files with 8 additions and 8 deletions

View File

@ -2127,20 +2127,20 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// 事件返回的公共成员 // 事件返回的公共成员
var obj = { var obj = {
tr: tr //行元素 tr: tr, // 行元素
,config: options config: options,
,data: table.clearCacheKey(data) //当前行数据 data: table.clearCacheKey(data), // 当前行数据
,index: index index: index,
,del: function(){ //删除行数据 del: function(){ // 删除行数据
table.cache[that.key][index] = []; table.cache[that.key][index] = [];
tr.remove(); tr.remove();
that.scrollPatch(); that.scrollPatch();
} },
,update: function(fields, related){ // 修改行数据 update: function(fields, related){ // 修改行数据
fields = fields || {}; fields = fields || {};
layui.each(fields, function(key, value){ layui.each(fields, function(key, value){
var td = tr.children('td[data-field="'+ key +'"]'); var td = tr.children('td[data-field="'+ key +'"]');
var cell = td.children(ELEM_CELL); //获取当前修改的列 var cell = td.children(ELEM_CELL); // 获取当前修改的列
// 更新缓存中的数据 // 更新缓存中的数据
data[key] = obj.data[key] = value; data[key] = obj.data[key] = value;