我想创建两个链接:全部展开和全部折叠,用于处理 aciTree 中所有节点的打开和关闭。谁能帮我解决这个问题?我找到了为选定节点打开的代码。但我需要它用于所有 inode。这是代码
var api = $('#indvTree').aciTree('api');
var selectedItem = api.selected();
if (api.isInode(selectedItem)) {
// this is a tree inode
if (api.isOpen(selectedItem)) {
// if already opened
alert('you need to select a closed inner node\nthe current one is already open');
} else {
// open the inner item
api.open(selectedItem, {
uid: 'my-custom-button',
success: function(item, options) {
var itemId = this.getId(item);
alert('a item was just opened, the item ID was ' + itemId);
},
fail: function(item, options) {
var itemId = this.getId(item);
alert('failed to open the item with the ID ' + itemId);
},
_custom_property: 'some-custom-value'
});
}
} else {
// no selected item or not a tree inode item
alert('you need to select a closed inner node first');
}