首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在ExtJs4.1 TreePanel中隐藏节点

在ExtJs4.1 TreePanel中隐藏节点
EN

Stack Overflow用户
提问于 2013-10-04 20:02:25
回答 2查看 2.6K关注 0票数 2

基于某些条件,我们如何隐藏ExtJs4.1 TreePanel中的一些节点?我们可以通过这样做来隐藏ExtJs 3.4中的节点:

代码语言:javascript
复制
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中不再支持此方法。

EN

回答 2

Stack Overflow用户

发布于 2013-10-05 00:00:46

在Sencha的论坛上有一个topic about this。这似乎不受支持,但有解决方法。

票数 2
EN

Stack Overflow用户

发布于 2016-03-29 00:04:40

例如,对于ExtJS 6,当read config为false时,隐藏节点:

代码语言:javascript
复制
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();
            }
        }
}

根目录:

代码语言:javascript
复制
{
    "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
                }
            ]
        }
    ]
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19180717

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档