基于某些条件,我们如何隐藏ExtJs4.1 TreePanel中的一些节点?我们可以通过这样做来隐藏ExtJs 3.4中的节点:
tree.getRootNode().cascade(function() { // descends into child nodes
if(this.attributes['status'] == 100) { // test this node
this.getUI().hide() // hide this node
}
})但在ExtJs 4.1中不再支持此方法。
发布于 2013-10-05 00:00:46
在Sencha的论坛上有一个topic about this。这似乎不受支持,但有解决方法。
发布于 2016-03-29 00:04:40
例如,对于ExtJS 6,当read config为false时,隐藏节点:
hideItemsReadFalse: function () {
var me = this,
items = me.getReferences().treelistRef.itemMap;
for(var i in items){
if(items[i].config.node.data.read == false){
items[i].destroy();
}
}
}根目录:
{
"text": "root",
"children": [
{
"text": "Atualização",
"iconCls": "x-fa fa-list",
"children": [
{
"leaf":true,
"text": "Empresas",
"module": "empresas",
"iconCls": "x-fa fa-building",
"read": false
},
{
"leaf":true,
"text": "Produtos",
"module": "produtos",
"iconCls": "x-fa fa-cubes",
"read": true
}
]
}
]
}https://stackoverflow.com/questions/19180717
复制相似问题