完善 treeTable 获取节点方法返回的节点对象信息,新增几个常用的节点方法方便调用

pull/1260/head
sunxiaobin89 2023-05-26 13:43:21 +08:00
parent fcfe5c2fed
commit 8e873dde1d
1 changed files with 16 additions and 0 deletions

View File

@ -372,6 +372,22 @@ layui.define(['table'], function (exports) {
dataIndex: treeNodeData[LAY_DATA_INDEX], dataIndex: treeNodeData[LAY_DATA_INDEX],
getParentNode: function () { getParentNode: function () {
return that.getNodeByIndex(treeNodeData[LAY_PARENT_INDEX]) return that.getNodeByIndex(treeNodeData[LAY_PARENT_INDEX])
},
update: function (data) {
return treeTable.updateNode(tableId, index, data)
},
remove: function () {
return treeTable.removeNode(tableId, index)
},
expand: function (opts) {
return treeTable.expandNode(tableId, $.extend({}, opts, {
index: index
}))
},
setChecked: function (opts) {
return treeTable.setRowChecked(tableId, $.extend({}, opts, {
index: index
}))
} }
}; };