Results 1 to 3 of 3

Thread: Adding node to Ext.data.TreeStore manually

  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2008
    Location
    Moscow
    Posts
    137

    Question Adding node to Ext.data.TreeStore manually

    I need some help. I have ordinary Ext.tree.Panel with Ext.data.TreeStore attached to it the only thing is that I need to add nodes to that store manually.

    For now I do like this :

    Code:
    var store = Ext.getStore('Machines'),
          root = store.getRootNode();
    
    root.appendChild(nodeConfig);
    this way node appears in the store, but it doesn't show in the tree, if I add node to the tree - node does not appear in the store. what am I doing wrong? can someone help? Maybe I need to call some function to synchronize? As I see now from the sources it should do it automatically, but getting events... But it doesn't happen

  2. #2
    Sencha User Phil Guerrant's Avatar
    Join Date
    May 2011
    Location
    Colorado
    Posts
    352
    Answers
    32

    Default

    adding a node to the store should make it appear in the tree. Perhaps you need to set "expanded: true" on the parent node, or call its expand() method after adding the childNode?

    The Tree Guide has some helpful information in this regard
    Phil Guerrant
    Ext JS - Development Team

  3. #3
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    64
    Answers
    6

    Default use createNode

    try this, this works for me

    Code:
    var node = root.createNode({
    	leaf: true, 
    	text: scode
    });
    root.appendChild(node)

Posting Permissions

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