Results 1 to 3 of 3

Thread: Issue in adding a new node

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    3
    Vote Rating
    0
      0  

    Default Issue in adding a new node

    Hi ALL,
    I am new to extjs. Working with extjs 4.0.2
    Trying to add a new node to a node in two ways as given below:

    Code:
    var vnode = tree.getSelectionModel().getSelection();
    var fnode = vnode[0];
    //var animationNode = fnode.appendChild(new Ext.data.NodeInterface()); // appending this way works
    
    var animationNode = new Ext.data.NodeInterface(); // This way of node creation is not working. 
    animationNode.set('text', 'ANIMAT');
    animationNode.set('allowDrag', false);
    animationNode.set('iconCls', 'icon-menu-animation');
    animationNode.set('id', 'ANIMAT'); 
    animationNode.set('qtip', 'Animation Node');
    animationNode.set('leaf', 'true');
    fnode.appendChild(animationNode);
    Why creation of new node and then appending the node is not working.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    I have used appendChild in 4.0.7 and 4.1.0 with no issues.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    3
    Vote Rating
    0
      0  

    Default

    i Mitchellsimoens,

    Thanks for the reply.

    which method have you followed.

    Code:
    var vnode = tree.getSelectionModel().getSelection();
    var fnode = vnode[0];
    
    var animationNode = fnode.appendChild(new Ext.data.NodeInterface()); 
    animationNode.set('text', 'ANIMAT');
    animationNode.set('allowDrag', false);
    animationNode.set('iconCls', 'icon-menu-animation');
    animationNode.set('id', 'ANIMAT'); 
    
    
    OR
    
    (The below approach is not working)
    var vnode = tree.getSelectionModel().getSelection();
    var fnode = vnode[0];
    var animationNode = new Ext.data.NodeInterface();
    animationNode.set('text', 'ANIMAT');
    animationNode.set('allowDrag', false);
    animationNode.set('iconCls', 'icon-menu-animation');
    animationNode.set('id', 'ANIMAT');
    fnode.appendChild(animationNode);
    If both the approach should work, then what is that I am missing in the second approach.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •