PDA

View Full Version : Dynamically adding a child element to a parent window



AakashGC
30 May 2014, 12:40 AM
Suppose i have created a window and have attached a button to it.

Ext.define('AM.view.user.Edit', {
extend: 'Ext.window.Window',
alias : 'widget.useredit',
..........
initComponent: function() {
this.items = [{xtype: 'button',
text:'start'
},



i have defined the panel in the 'view' folder :

Ext.define('AM.view.user.panel',{
extend: 'Ext.panel.Panel',
alias:'widget.userpanel',

Now i want to add instances of this panel to the above window as a child component dynamically on clicking the start button .

in the controller file :
this.control({
'useredit button' :{
click: this.addpanels
}

addpanels: function(btn)
{
}

what should i add in addpanels function to load the panel dynamically in the window...

Thanks,