PDA

View Full Version : Access to inner Components



micho2
30 Nov 2010, 9:33 AM
Hello,

I created a Panel with a toolbar docked on top.
How can I change that toolbar later, for exampe remove the refresh-button or add a new button.

Tnx Micho


mainPanel=new Ext.Panel(
{ layout: 'card',
items:
[ Panel1, Panel2],
dockedItems:
[ { xtype: 'toolbar',
dock: 'top',
defaults:
{ iconMask: true,
ui: 'plain'
},
items:
[ { iconCls: 'refresh' ,
handler: refresh
}
]
}
]
});

jeffremer
30 Nov 2010, 10:20 AM
I often do something like this:



var toolbar = new Ext.Toolbar({...});
var mainPanel = new Ext.Panel({
layout: 'card',
toolbar: toolbar,
items: [
...
],
dockedItems: [
toolbar
]
});

...

mainPanel.toolbar.doSomething();


Do something similar for the toolbar to get access to whatever buttons or behavior you want.

Animal
30 Nov 2010, 10:23 AM
mainPanel.child('toolbar').add(....

micho2
2 Dec 2010, 10:33 AM
Tnx, works fine!