Reputation: 12215
I have two Panels and I want to call one panel from the other one. I would like to destroy the first panel and render the second panel right where the first panel was. Is this the correct way to do that?
function create(){
var testButton = new Ext.Button({
text: 'Switch panel',
handler: function(){
Ext.getCmp('backgroundForm').destroy();
upload();
}
});
var backgroundForm = new Ext.Panel({
id: 'backgroundForm',
renderTo: 'mainPackage',
autoHeight: true,
buttons: [testButton]
});
}
function upload(){
var testButton = new Ext.Button({
text: 'Switch panel',
handler: function(){
alert('Test');
}
});
var backgroundForm = new Ext.Panel({
id: 'newBackgroundForm',
renderTo: 'mainPackage',
autoHeight: true,
button[newTestButton]
});
}
Upvotes: 0
Views: 537
Reputation: 586
you could of course put both panels in a card layout, or you could use panel.remove() and panel.add() to parent , to add and remove panels
Upvotes: 1