From c9d67979f506a37ac69d3ecb1215b22a360460d0 Mon Sep 17 00:00:00 2001 From: sunxiaobin89 <470459819@qq.com> Date: Tue, 29 Aug 2023 02:38:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20treeTable=20data=20?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=E6=8E=92=E5=BA=8F=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E8=8A=82=E7=82=B9=E7=BB=93=E6=9E=84=E9=94=99?= =?UTF-8?q?=E4=B9=B1=E7=9A=84=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 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js index 291366b8..0696c86b 100644 --- a/src/modules/treeTable.js +++ b/src/modules/treeTable.js @@ -190,6 +190,9 @@ layui.define(['table'], function (exports) { indeterminate: !checkStatus.isAll && checkStatus.data.length }) } + if (!isRenderData && thatOptionsTemp.autoSort && thatOptionsTemp.initSort && thatOptionsTemp.initSort.type) { + treeTable.sort(id); + } that.renderTreeTable(tableView); @@ -909,7 +912,7 @@ 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 && options.autoSort) { return treeTable.sort(id); } var trAll = table.getTrHtml(id, tableDataFlat); @@ -1126,7 +1129,8 @@ layui.define(['table'], function (exports) { Class.prototype.getTableData = function () { var that = this; var options = that.getOptions(); - return options.url ? table.cache[options.id] : options.data; + // return options.url ? table.cache[options.id] : options.data; + return table.cache[options.id]; } treeTable.updateStatus = function (id, statusObj, data) { @@ -1147,7 +1151,7 @@ layui.define(['table'], function (exports) { if(!that) return; var options = that.getOptions(); - if (!options.url || options.autoSort) { + if (options.autoSort) { that.initData(); treeTable.renderData(id); }