Question

when i create sub node using fallowing function newly create node not view in the tree nodes. but reload page using press F5 key. show newly create node in the tree nodes how can i view node without reload webpage?

  createSubCategory: function() {
     dt    = new Date();
     id    = dt.format('U');
     name  = 'New Sub-Category'
     if(this.treepanelSkillCat.selModel.selNode == null) 
     {
        Ext.MessageBox.show({
           buttons: Ext.MessageBox.OK,
           icon:Ext.MessageBox.ERROR
        });
        return false;   
     }         
     var parent        = this.treepanelSkillCat.selModel.selNode.id;      

     var newNode       = new Ext.tree.AsyncTreeNode({id: id, text: name, leaf: false});
     form_data         = {'SKL_CAT_ID': id , 'SKL_CAT_NAME' : name, 'PARENT_SKL_CAT_ID' :parent }; 

     this.nodeAction   = 'addtotree';
     this.selNode      = newNode;   

     this.submitNode(form_data,'addtotree');
     this.treepanelSkillCat.selModel.selNode.appendChild(newNode);
  },

before reload after reload can view newly add sub child node in the last node as below

Was it helpful?

Solution

Try reloading the treePanel store in the callback of your submitNode method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top