繁体   English   中英

如何在extjs中销毁面板

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM