Search code examples
extjsextjs3

fire treeloader with new url on node click extjs 3


I am trying append child nodes to a tree node when the node is clicked. It is required to fire a tree loader with desired url whenever a particular node is clicked.

I tried something like this

tree.dataUrl = '/zport/clusterSysReg?args=/directory/'+node.attributes.name;
//alert(tree.dataUrl);
node.reload();

whenever I click on a node the child nodes are created but not with the new url, but with the old url, I also tried node.load instead of node.reload(), but I am getting an error .........

Any idea how to proceed


Solution

  • Here is the solution to the above problem (took me whole day to solve this) Inside the listner function added the following lines

    listeners: {
       'render': function(tp){
    
                tp.getSelectionModel().on('selectionchange', function(tree, node){
    
                tp.getLoader().dataUrl = '/zport/clusterSysReg?args='+node.attributes.name;
                tp.getLoader().load(node);
                ...................... 
                ......................
                }
    }