我有两个面板,我想从另一个面板调用一个面板。我想销毁第一个面板并在第一个面板所在的位置渲染第二个面板。这是正确的方法吗?
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]
});
}