mirror of https://github.com/layui/layui
优化 `treeTable.addNodes()` 方法参数,采用 `options` 形式
parent
9dd893ebaf
commit
2ca56ae5ee
|
@ -993,12 +993,21 @@ layui.define(['table'], function (exports) {
|
|||
* @param {Boolean} focus 新增的节点,单个或者多个
|
||||
* @return {Array} 新增的节点
|
||||
* */
|
||||
treeTable.addNodes = function (id, parentIndex, index, newNodes, focus) {
|
||||
treeTable.addNodes = function (id, opts) {
|
||||
var that = getThisTable(id);
|
||||
if(!that) return;
|
||||
|
||||
var options = that.getOptions();
|
||||
var treeOptions = options.tree;
|
||||
var tableViewElem = options.elem.next();
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
var parentIndex = opts.parentIndex;
|
||||
var index = opts.index;
|
||||
var newNodes = opts.newNodes;
|
||||
var focus = opts.focus;
|
||||
|
||||
parentIndex = layui.type(parentIndex) === 'number' ? parentIndex.toString() : parentIndex;
|
||||
var parentNode = parentIndex ? that.getNodeDataByIndex(parentIndex) : null;
|
||||
index = layui.type(index) === 'number' ? index : -1;
|
||||
|
|
Loading…
Reference in New Issue