2013-10-04 114 views
1

如何根據某些條件隱藏ExtJs 4.1 TreePanel中的某些節點? 我們可以通過這樣的ExtJS的3.4隱藏節點:在ExtJs中隱藏節點4.1 TreePanel

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不再支持。

+0

如果你從商店中刪除記錄他們不會露面那個樹。如果您需要動態顯示和隱藏命令,則可以過濾商店。 – dbrin

回答

1

在Sencha的論壇上有一個topic about this。看起來這不被支持,但有解決方法。

0

對於ExtJS的6,例如,當讀取配置是假的,隱藏的節點:

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 
       } 
      ] 
     } 
    ] 
} 
相關問題