PDA

View Full Version : Dynamically adding items to Panel



mayur.tendulkar
27 Sep 2010, 11:39 PM
Hi all,
I just wanted to know, how can I add items dynamically (using code) in a panel. My panel is already created and has a toolbar in it. Once I click on a button inside toolbar, I want to add map inside the panel.
Thanks.

evant
27 Sep 2010, 11:49 PM
var map = new Ext.Map();
panel.add(map);
panel.doLayout();

Ourysso
28 Sep 2010, 3:59 AM
var map = new Ext.Map();
panel.add(map);
panel.doLayout();


Didn't Work. ;P
I tried it:
var painel = new Telasistema.agendaSalasPanel();
Ext.getCmp('painel_conteudo').add(painel);
Ext.getCmp('painel_conteudo').doLayout();

What am I doing wrong?

evant
28 Sep 2010, 4:06 AM
It does work, however you haven't provided any context at all so I can't say.



Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady : function() {
var p = new Ext.Panel({
fullscreen: true,
layout: 'fit'
});

setTimeout(function(){
p.add(new Ext.Panel({
html: 'Foo'
}));
p.doLayout();
}, 2000);


}
});