Results 1 to 2 of 2

Thread: static treePanel question

  1. #1
    Sencha Premium User
    Join Date
    Nov 2008
    Posts
    374

    Default static treePanel question

    The tree is initially appears correctly with rootNodeONE.
    When I press the button I see rootNodeTWO.
    This does not work.
    How can I do?
    Thanks

    Code:
    ........
        var rootNodeONE = {
            "text":"ROOT NODE ONE",
            "expanded":"false",
            "children": [
            {"text":"ONE",
            "cls":"folder",
            "children": [
                {"text":"ONE",
                "leaf":"true"}
            ]}
        ]}
        
        var rootNodeTWO = {
            "text":"ROOT NODE TWO",
            "expanded":"false",
            "children": [
            {"text":"TWO",
            "cls":"folder",
            "children": [
                {"text":"TWO",
                "leaf":"true"}
            ]}
        ]}
        
        var treePanel = { 
            xtype : 'treepanel',
            id : 'treePanel',
            title: 'Tree',        
            autoScroll : true,        
            root: rootNodeONE,
            buttons: [{
                text: 'TWO',
                    handler:function(){
                        Ext.getCmp("treePanel").root = rootNodeTWO
                        Ext.getCmp("treePanel").getRootNode().reload();                                
                    }        
            }]             
        }
    ........

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    You cant' just set the "root" property.

    http://www.sencha.com/deploy/dev/doc...er=setRootNode

    And reload()? It hasn't been loaded.

    You want it to expand?

Similar Threads

  1. Replies: 41
    Last Post: 12 Apr 2012, 9:29 PM
  2. Problem loading static JSON into TreePanel config from a web method call
    By parky128 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 13 Apr 2010, 2:38 AM
  3. TreePanel with static data
    By elliottmina in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 3 Dec 2007, 1:32 PM
  4. Question about static tree
    By tjshin in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 19 Jun 2007, 7:46 AM

Posting Permissions

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