PDA

View Full Version : how to make treepanel auto expand



rubynile
14 Oct 2009, 2:36 AM
This is my tree panel.i want to expand the treepanel automaticaly when we open..how to do this if anyone know please help me:((


var Menu_Tree = new Ext.tree.TreePanel({
title:'OOH CRM',
autoScroll:true,
region:'west',
animate:true,
enableDD:false,
containerScroll: true,
split:true,
collapsible:true,
titleCollapse:true,
width:175,
loader: new Ext.tree.TreeLoader({
dataUrl:'../common/get_menu.jsp?moduleid=crm'
}),
loadingText:'Loading',
root:new Ext.tree.AsyncTreeNode({text:'Main Menu',expanded:true})
});

14 Oct 2009, 3:38 AM
Expand the treepanel or the tree nodes?

rubynile
14 Oct 2009, 3:55 AM
can you please help me with sample code.how to expand

14 Oct 2009, 4:09 AM
how about answering my question first :)

Animal
14 Oct 2009, 4:12 AM
Your root node will be expanded on render. It will show all of the children that "../common/get_menu.jsp?moduleid=crm'" returned.

And when you check Firebug, what exactly got returned?

rubynile
14 Oct 2009, 4:20 AM
Well I tried it on the main menu


var Menu_Tree = new Ext.tree.TreePanel({
title:'OOH CRM',
autoScroll:true,
region:'west',
animate:true,
enableDD:false,
containerScroll: true,
split:true,
collapsible:true,
titleCollapse:true,
width:175,
loader: new Ext.tree.TreeLoader({
dataUrl:'../common/get_menu.jsp?moduleid=crm'
}),
loadingText:'Loading',
root:new Ext.tree.AsyncTreeNode({text:'Main Menu',expanded:true})
});
but the tree load main menu automatically not the OOH CRM
But i need to make it expandable as the 2 picture when the window loads:-/

14 Oct 2009, 4:21 AM
And......... are the child nodes set to 'expanded : true' ?

14 Oct 2009, 4:23 AM
And......... are the child nodes set to 'expanded : true' ?

rubynile
14 Oct 2009, 4:51 AM
This only am getting in firebug


[{'text' : 'OOH CRM', 'id' : 400000, 'leaf' : false,'cls' : 'folder',
'children' : [{'text':'Campaign', 'id':'40000', 'leaf' : true, 'iconCls' : 'CampaignIcons', 'href' : 'javascript:crm_PageLoad(40000,"Campaign","../crm/campaign_list.jsp")'},
{'text':'Lead', 'id':'40005', 'leaf' : true, 'iconCls' : 'leadicon', 'href' : 'javascript:crm_PageLoad(40005,"Lead","../crm/lead_list.jsp")'},
{'text':'Reports', 'id':'40060', 'leaf' : true, 'iconCls' : 'piechartIcon', 'href' : 'javascript:crm_PageLoad(40060,"Reports","../crm/qry_master_desingner.jsp")'}]}]

14 Oct 2009, 4:57 AM
yeah, i don't see expanded anywhere in there.

Animal
14 Oct 2009, 4:57 AM
{'text' : 'OOH CRM', 'id' : 400000, 'leaf' : true,


You told it that 'OOH CRM' is a leaf.

rubynile
14 Oct 2009, 5:16 AM
Thanks alot for the help everybody.i got output.I included expanded:true.