1. #1
    Sencha User
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    178
    Vote Rating
    2
    Answers
    4
    renganathan is on a distinguished road

      0  

    Default Unanswered: How to expand particular node in tree panel - Extjs 4

    Unanswered: How to expand particular node in tree panel - Extjs 4


    hi all,

    i would like to know , How to expand the particular node in the tree panel?

    Please share ur experience.
    Thanks,

    RENGANATHAN M G

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,623
    Vote Rating
    331
    Answers
    550
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Nodes have an expand method:

    http://docs.sencha.com/ext-js/4-0/#!...-method-expand

    A node can also be created expanded:

    http://docs.sencha.com/ext-js/4-0/#!...e-cfg-expanded

    Trees have an expandPath method:

    http://docs.sencha.com/ext-js/4-0/#!...hod-expandPath

    The format used by expandPath is compatible with getPath:

    http://docs.sencha.com/ext-js/4-0/#!...method-getPath

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    178
    Vote Rating
    2
    Answers
    4
    renganathan is on a distinguished road

      0  

    Default


    Hi,

    can u give some working example?
    Thanks,

    RENGANATHAN M G

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,623
    Vote Rating
    331
    Answers
    550
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    You haven't given enough information on what you're trying to do for us to provide you with an example.

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    178
    Vote Rating
    2
    Answers
    4
    renganathan is on a distinguished road

      0  

    Default expand particular node in tree panel

    expand particular node in tree panel


    Code:
         var invTreeStore         = Ext.create('Ext.data.TreeStore', 
        {
                proxy                : {
                type                  : 'ajax',
                url                    : 'lab_tree.class.php'//'get_tree_nodes.php'
            },
            root                : {
                text            : 'Labs',
                id                : '0|getLabs',
                expanded        : true
            },
            folderSort            : true,
            sorters                : [{
                property        : 'text',
                direction        : 'ASC'
            }]
        });
        
        
        
            var labTree             = Ext.create('Ext.tree.Panel', 
        {
            //title                : 'labTree',
            renderTo            : Ext.getBody(),
            id                    : 'labTree',
            lines                : true,
            autoHeight             : true,
            containerScroll        : true,
            autoScroll            : true,
            frame                :true,
            iconCls                : 'icon-basket',
            style                : 'padding-bottom: 5px', 
            store                : invTreeStore,//powerTreeStore,
            rootVisible            : false,
            //collapsed            : true,
            listeners            : 
            {
                    itemclick      : function clickListener (view, rec, item, index, eventObj) 
            { 
    
                labhidden.setValue(rec.raw.chain['lab']);
                
                aislehidden.setValue(rec.raw.chain['aisle']);
                
                aislelochidden.setValue(rec.raw.chain['aisle_location']);
                
                deviceStore.load();
    
                    
            }
            
            },
            
             dockedItems: [{
                xtype: 'toolbar',
                items: [{
                    text: 'Expand All',
                    handler: function(){
                        labTree.expandAll();
                    }
                }, {
                    text: 'Collapse All',
                    handler: function(){
                        labTree.collapseAll();
                    }
                }]
            }]
        });

    This is my code for tree panel. i want to expand one particular node by default.
    Thanks,

    RENGANATHAN M G

  6. #6
    Sencha User
    Join Date
    Feb 2012
    Posts
    5
    Vote Rating
    0
    Pramma is on a distinguished road

      0  

    Default try this

    try this


    If you know the Id of the node you can do tree.expandPath(store.getNodeById(id).getPath())

Thread Participants: 2

Tags for this Thread