From 4b92c4289f4e756a96a0094e14a4dbf8c03db254 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:21:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20`treeTable.checkNode()`=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=8F=82=E6=95=B0=EF=BC=8C=E9=87=87=E7=94=A8?= =?UTF-8?q?=20`options`=20=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/treeTable.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js index 8b495b93..13b3cc0e 100644 --- a/src/modules/treeTable.js +++ b/src/modules/treeTable.js @@ -922,7 +922,10 @@ layui.define(['table'], function (exports) { // 处理setRowChecked obj.setRowChecked = function (checked) { - treeTable.checkNode(tableId, trData, checked); + treeTable.checkNode(tableId, { + node: trData, + checked: checked + }); } } @@ -1427,13 +1430,19 @@ layui.define(['table'], function (exports) { * @param {Boolean} checked 选中或取消 * @param {Boolean} [callbackFlag] 是否触发事件回调 * */ - treeTable.checkNode = function (id, node, checked, callbackFlag) { + treeTable.checkNode = function (id, opts) { var that = getThisTable(id); if(!that) return; var options = that.getOptions(); var tableView = options.elem.next(); + opts = opts || {}; + + var node = opts.node; + var checked = opts.checked; + var callbackFlag = opts.callbackFlag; + var dataIndex = layui.type(node) === 'string' ? node : node[LAY_DATA_INDEX]; // 判断是否在当前页面中 var nodeData = that.getNodeDataByIndex(dataIndex);