Browse Source

修复 treeTable 开启了排序并且在 `done` 回调中执行了 `expandAll` 展开全部导致死循环问题

pull/1281/head
sunxiaobin89 1 year ago
parent
commit
9576df6908
  1. 9
      src/modules/treeTable.js

9
src/modules/treeTable.js

@ -171,6 +171,11 @@ layui.define(['table'], function (exports) {
options.done = function () {
var args = arguments;
var doneThat = this;
that.initSort = doneThat.initSort;
var isRenderData = args[3]; // 是否是 renderData
if (!isRenderData) {
delete that.isExpandAll;
}
var tableView = this.elem.next();
that.updateStatus(null, {
@ -891,7 +896,9 @@ layui.define(['table'], function (exports) {
d[idKey] !== undefined && (that.status.expand[d[idKey]] = true);
}
});
if (options.initSort && options.initSort.type && (!options.url || options.autoSort)) {
if (options.initSort && options.initSort.type &&
(!that.initSort || options.initSort.type !== that.initSort.type && options.initSort.field !== that.initSort.field) &&
(!options.url || options.autoSort)) {
return treeTable.sort(id);
}
var trAll = table.getTrHtml(id, tableDataFlat);

Loading…
Cancel
Save