From 06982a505105e969481f094a5fe35129fd6723db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Fri, 21 Apr 2023 09:00:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20treeTable=20=E5=A4=96?= =?UTF-8?q?=E9=83=A8=E6=96=B9=E6=B3=95=E5=BD=93=20`id`=20=E4=B8=BA?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E5=88=B0=E5=AF=B9=E5=BA=94=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/treeTable.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js index 08c28e9c..057c2a77 100644 --- a/src/modules/treeTable.js +++ b/src/modules/treeTable.js @@ -352,6 +352,7 @@ layui.define(['table'], function (exports) { treeTable.getNodeDataByIndex = function (id, index) { var that = getThisTable(id); + if(!that) return; return that.getNodeDataByIndex(index, true); } @@ -782,6 +783,8 @@ layui.define(['table'], function (exports) { * */ treeTable.formatNumber = function (id) { var that = getThisTable(id); + if(!that) return; + var options = that.getOptions(); var tableViewElem = options.elem.next(); @@ -875,6 +878,8 @@ layui.define(['table'], function (exports) { treeTable.sort = function (id) { var that = getThisTable(id); + if(!that) return; + var options = that.getOptions(); var initSort = options.initSort; @@ -924,6 +929,8 @@ layui.define(['table'], function (exports) { // 更新数据 treeTable.updateNode = function (id, index, newNode) { var that = getThisTable(id); + if(!that) return; + var options = that.getOptions(); var treeOptions = options.tree; var tableView = options.elem.next(); @@ -951,6 +958,8 @@ layui.define(['table'], function (exports) { // 删除数据 treeTable.removeNode = function (id, node) { var that = getThisTable(id); + if(!that) return; + var options = that.getOptions(); var treeOptions = options.tree; var tableView = options.elem.next(); @@ -1126,8 +1135,10 @@ layui.define(['table'], function (exports) { return newNodes; } + // 获取表格选中状态 treeTable.checkStatus = function (id) { var that = getThisTable(id); + if(!that) return; // 需要区分单双选 var tableData = treeTable.getData(id, true); @@ -1418,6 +1429,8 @@ layui.define(['table'], function (exports) { * */ treeTable.checkNode = function (id, node, checked, callbackFlag) { var that = getThisTable(id); + if(!that) return; + var options = that.getOptions(); var tableView = options.elem.next(); @@ -1440,6 +1453,8 @@ layui.define(['table'], function (exports) { treeTable.checkAllNodes = function (id, checked) { var that = getThisTable(id); + if(!that) return; + var options = that.getOptions(); var tableView = options.elem.next();