[英]How to destroy a Panel in extjs
我有一個邊框布局,其中西側有幾個按鈕。 單擊按鈕后,中央面板中將顯示幾個面板。 這是顯示在中央面板中的一個面板的示例代碼。
{
xtype: 'myPanel', // User define panel
itemId: 'myPanel1',
showZoom: false,
showLegends:false,
showSlider: false,
showDataGrid: true,
chartType: 'line',
controlPanel:false,
orientation: 'x'
}
現在,我有一個叫設置的按鈕,它可以打開一個窗口。 具有一些復選框的窗口。 在那個我有一個復選框稱為圖例。 我想要當我單擊復選框圖例,然后從面板上方showLegends:true。當showLegends為true時,它將創建一個Legendpanel面板,如果為false,則我想破壞該面板。
ShowLegends:真
if (me.showLegends) {
legendPanel = Ext.create('Igo.panel.LegendsPanel', {
itemId: graphConfig.itemId + 'legends',
graphId: graphConfig.itemId
});
}
cPanel.add(gPanel);
如果Showlegends為假,我如何銷毀該面板。請回答此問題!
希望這會有所幫助,Ext.getCmp(id)為您提供具有已知id的對象,在您的情況下為myPanel1
if (me.showLegends) {
legendPanel = Ext.create('Igo.panel.LegendsPanel', {
itemId: graphConfig.itemId + 'legends',
graphId: graphConfig.itemId
});
}else{
Ext.getCmp("myPanel1").destroy()
}
if (me.showLegends) { legendPanel = Ext.create('Igo.panel.LegendsPanel', { itemId: graphConfig.itemId + 'legends', graphId: graphConfig.itemId }); } else { if(legendPanel) parentnode.remove(legendPanel,true); //ParentNode is parent component of legentPanel, second argument oprional. }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.