Results 1 to 3 of 3

Thread: Could not append a child node to a tree node

  1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    16

    Default Could not append a child node to a tree node

    Hi, I am trying to append a child node to a tree node that is not the root. this is what I did:

    Code:
    var parentNode = Ext.getCmp('tree').getNodeById('parentNode');
    var childNode = parentNode.appendChild({
         text: 'test',
         leaf: true
    });
    I was not able to see the child node after the page is loaded. However, if i add "childNode.render();" after the above code, I can see this node, but if I mouse over the node, I get a null error.

    Does anybody have any idea what the problem is? Thanks!

  2. #2
    Sencha User
    Join Date
    Jun 2009
    Posts
    16

    Default

    Actually, I just found out a way to do what I wanted right after submitting this post.

    Originally I set the "expanded" property of "parentNode" to "false" at the creation of this parent node. But if I change it to "true", the "childNode" shows! I then simply added "parentNode.collapse();" to achieve the intended behavior.

    It would be nice if someone could explain why this is happening.

  3. #3

    Default

    it is typical DOM behavior even after adding new component it doesn't appear sometimes, refreshing it or any of its parent component will make it appear. This could be due to problems in rendering.

Posting Permissions

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