how to reload a selected node of a tree

I need to reload a tree after deleting one of the leafs of a node. The problem of reloading the entire store is, it's too slow. That's why I just want to reload a node where its leaf is deleted.

I tried this.. but it says null...

Ext.getCmp('myTree').root.reload();

I also tried

var tempParent = Ext.getCmp('myTree').getSelectionModel().getSelection()[0].parentNode;
Ext.StoreMgr.lookup('myStore').load( {node: tempParent});

this doesn't help either... Does anyone have similar issues that's been solved?

Update

var node = Ext.getCmp('myTree').getSelectionModel().getSelection()[0].parentNode.get('id');

this does give me the parent node... but When I load it

Ext.getCmp('myTree').store.load({ node: node });

I get this error

TypeError: b.getId is not a function

Second Update--

This is what my tree looks like

  • 1st Node

  • 1st Leaf
  • 2nd Node

  • 1st Leaf
  • Now when I delete the 1st Leaf of the 2nd Node... the 1st Node appears under 2nd Node

  • 1st Node

  • 1st Leaf
  • 2nd Node

  • 1st Node

  • Here is how to refresh a specific node of a tree. In your case you may want to refresh a parent node under which changes need to be shown:

       refreshRow:function(id){
            var node = this.store.getNodeById(id);
            if (node){
                this.store.load({node:node});
            }
         }
    

    Update

    Based on the information you provided my conclusion is that you are trying to populate the same Node with a specific server generated ID in several places in a Tree. The tree store does not support this. Each node must have a unique ID even if the the rest of the Node information is the same.

    链接地址: http://www.djcxy.com/p/68160.html

    上一篇: 诅咒newwin和subwin之间的区别

    下一篇: 如何重新加载树的选定节点