mirror of https://github.com/layui/layui
新增 treeTable `expandAllDefault` 是否默认展开全部节点
parent
9576df6908
commit
451a1df48b
|
@ -230,6 +230,7 @@ layui.define(['table'], function (exports) {
|
||||||
id: "id", // 唯一标识的属性名称
|
id: "id", // 唯一标识的属性名称
|
||||||
pid: "parentId", // 父节点唯一标识的属性名称
|
pid: "parentId", // 父节点唯一标识的属性名称
|
||||||
icon: "icon", // 图标的属性名称
|
icon: "icon", // 图标的属性名称
|
||||||
|
expandAllDefault: false, // 默认展开所有节点
|
||||||
},
|
},
|
||||||
view: {
|
view: {
|
||||||
indent: 14, // 层级缩进量
|
indent: 14, // 层级缩进量
|
||||||
|
@ -738,6 +739,7 @@ layui.define(['table'], function (exports) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
treeTableThat.isExpandAll = false;
|
||||||
// 关闭
|
// 关闭
|
||||||
if (sonSign && !isToggle) { // 非状态切换的情况下
|
if (sonSign && !isToggle) { // 非状态切换的情况下
|
||||||
layui.each(childNodes, function (i1, item1) {
|
layui.each(childNodes, function (i1, item1) {
|
||||||
|
@ -814,6 +816,7 @@ layui.define(['table'], function (exports) {
|
||||||
var that = getThisTable(id);
|
var that = getThisTable(id);
|
||||||
if (!that) return;
|
if (!that) return;
|
||||||
|
|
||||||
|
that.isExpandAll = expandFlag;
|
||||||
var options = that.getOptions();
|
var options = that.getOptions();
|
||||||
var treeOptions = options.tree;
|
var treeOptions = options.tree;
|
||||||
var tableView = options.elem.next();
|
var tableView = options.elem.next();
|
||||||
|
@ -1014,6 +1017,10 @@ layui.define(['table'], function (exports) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!level && treeOptions.view.expandAllDefault && that.isExpandAll === undefined) {
|
||||||
|
return treeTable.expandAll(tableId, true); // 默认展开全部
|
||||||
|
}
|
||||||
|
|
||||||
// 当前层的数据看看是否需要展开
|
// 当前层的数据看看是否需要展开
|
||||||
if (sonSign !== false && dataExpand) {
|
if (sonSign !== false && dataExpand) {
|
||||||
layui.each(dataExpand, function (index, item) {
|
layui.each(dataExpand, function (index, item) {
|
||||||
|
|
Loading…
Reference in New Issue