View Full Version : Expanding a treePanel and appending a child in 1 call help please

26 Jan 2010, 10:41 PM
panelOrderSearch is a normal panel as a region 'north' of another panel layout: border,
panelOrderTreeSearch is the treepanel as an item of the panel
and panelOrderSearchRoot is the root of the treepanel

Anyways I'm trying to do an expand of the panelOrderSearch followed by adding a child node to the tree panel that is a child of it. panelOrderSearch is created with collapsed: true, collapsible: true.

If I manually expand panelOrderSearch and click the button it works fine, any ideas how I can get the expand and append working in 1 click?

I did try executing the appendChild as an on expand event function, no luck.

buttons: [{
id: 'panelSearchMainButton',
text: 'Search',
formBind: true,
handler: function(){
var panelOrderSearch = Ext.getCmp('panelOrderSearch');
var panelOrderTreeSearch = Ext.getCmp('panelTreeOrderSearch');
var panelOrderSearchRoot = panelOrderTreeSearch.getRootNode();


new Ext.tree.TreeNode({
id: 'rootOrderSearchResults',
allowDrop: false,
iconCls: 'magnifyGlassIcon',
text: 'Search Results'


26 Jan 2010, 11:02 PM
If the expand is animated, it won't complete by the time you call appendChild.

Do the appendChild in the callback parameter of expand.

26 Jan 2010, 11:06 PM
API says the only param is a Boolean animate?

"expand( Boolean animate ) : Ext.Panel"

How do I set the callback func?

Thanks btw!