mirror of https://github.com/layui/layui
修复treeTable设置cols的type: 'numbers'折叠时不更新问题
修复treeTable设置cols的type: 'numbers'折叠时不更新问题pull/1336/head
parent
92ac009e41
commit
0154c99fd8
|
@ -602,7 +602,11 @@ layui.define(['table'], function (exports) {
|
||||||
options: options,
|
options: options,
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
treeTableThat.updateStatus(childNodes, function (d) {
|
||||||
|
d['LAY_HIDE'] = false;
|
||||||
|
});
|
||||||
|
options.hasNumberCol && formatNumber(tableId);
|
||||||
} else {
|
} else {
|
||||||
var asyncSetting = treeOptions.async || {};
|
var asyncSetting = treeOptions.async || {};
|
||||||
var asyncUrl = asyncSetting.url || options.url;
|
var asyncUrl = asyncSetting.url || options.url;
|
||||||
|
@ -760,6 +764,11 @@ layui.define(['table'], function (exports) {
|
||||||
tableViewElem.find(childNodesFlat.map(function (value, index, array) {
|
tableViewElem.find(childNodesFlat.map(function (value, index, array) {
|
||||||
return 'tr[lay-data-index="' + value[LAY_DATA_INDEX] + '"]'
|
return 'tr[lay-data-index="' + value[LAY_DATA_INDEX] + '"]'
|
||||||
}).join(',')).addClass(HIDE);
|
}).join(',')).addClass(HIDE);
|
||||||
|
|
||||||
|
treeTableThat.updateStatus(childNodes, function (d) {
|
||||||
|
d['LAY_HIDE'] = true;
|
||||||
|
});
|
||||||
|
options.hasNumberCol && formatNumber(tableId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,13 +1038,14 @@ layui.define(['table'], function (exports) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
debounceFn('renderTreeTable-' + tableId, function () {
|
debounceFn('renderTreeTable-' + tableId, function () {
|
||||||
options.hasNumberCol && formatNumber(that);
|
options.hasNumberCol && formatNumber(tableId);
|
||||||
form.render($('.layui-table-tree[lay-id="' + tableId + '"]'));
|
form.render($('.layui-table-tree[lay-id="' + tableId + '"]'));
|
||||||
}, 0)();
|
}, 0)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var formatNumber = function (that) {
|
var formatNumber = function (id) {
|
||||||
|
var that = getThisTable(id);
|
||||||
var options = that.getOptions();
|
var options = that.getOptions();
|
||||||
var tableViewElem = options.elem.next();
|
var tableViewElem = options.elem.next();
|
||||||
|
|
||||||
|
@ -1044,6 +1054,7 @@ layui.define(['table'], function (exports) {
|
||||||
var trFixedL = tableViewElem.find('.layui-table-fixed-l tbody tr');
|
var trFixedL = tableViewElem.find('.layui-table-fixed-l tbody tr');
|
||||||
var trFixedR = tableViewElem.find('.layui-table-fixed-r tbody tr');
|
var trFixedR = tableViewElem.find('.layui-table-fixed-r tbody tr');
|
||||||
layui.each(that.treeToFlat(table.cache[options.id]), function (i1, item1) {
|
layui.each(that.treeToFlat(table.cache[options.id]), function (i1, item1) {
|
||||||
|
if (item1['LAY_HIDE']) return;
|
||||||
var itemData = that.getNodeDataByIndex(item1[LAY_DATA_INDEX]);
|
var itemData = that.getNodeDataByIndex(item1[LAY_DATA_INDEX]);
|
||||||
itemData['LAY_NUM'] = ++num;
|
itemData['LAY_NUM'] = ++num;
|
||||||
trMain.eq(i1).find('.laytable-cell-numbers').html(num);
|
trMain.eq(i1).find('.laytable-cell-numbers').html(num);
|
||||||
|
@ -1242,7 +1253,7 @@ layui.define(['table'], function (exports) {
|
||||||
layui.each(table.cache[id], function (i4, item4) {
|
layui.each(table.cache[id], function (i4, item4) {
|
||||||
tableView.find('tr[data-level="0"][lay-data-index="' + item4[LAY_DATA_INDEX] + '"]').attr('data-index', i4);
|
tableView.find('tr[data-level="0"][lay-data-index="' + item4[LAY_DATA_INDEX] + '"]').attr('data-index', i4);
|
||||||
})
|
})
|
||||||
options.hasNumberCol && formatNumber(that);
|
options.hasNumberCol && formatNumber(id);
|
||||||
|
|
||||||
// 重新适配尺寸
|
// 重新适配尺寸
|
||||||
treeTable.resize(id);
|
treeTable.resize(id);
|
||||||
|
|
Loading…
Reference in New Issue