From 9576df6908167f6f68f90100faea4eedff0721bf Mon Sep 17 00:00:00 2001 From: sunxiaobin89 <285584806@qq.com> Date: Wed, 14 Jun 2023 11:34:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20treeTable=20=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E4=BA=86=E6=8E=92=E5=BA=8F=E5=B9=B6=E4=B8=94=E5=9C=A8?= =?UTF-8?q?=20`done`=20=E5=9B=9E=E8=B0=83=E4=B8=AD=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E4=BA=86=20`expandAll`=20=E5=B1=95=E5=BC=80=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=AD=BB=E5=BE=AA=E7=8E=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/treeTable.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js index e6115e35..0da38eac 100644 --- a/src/modules/treeTable.js +++ b/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);