I am new to Extjs. I am trying to destroy my component.
To achieve this, I am trying to pass my component name using the getCmp
method.I am unsure how to pass the id.
This is my component id
-
Ext.tab.Panel{itemId: "sportsSeenTabPanels", id:"panel-117"}
providing my code below
if (ball.Desktop.isConfigured()) {
ball.Desktop.onMainContentDestroy(function() {
Ext.getCmp('id').destroy();
});
}
The following is the error I receive -
Uncaught TypeError: Cannot read property 'destroy' of undefined
if you make a component/panel like this :
Ext.create('Ext.panel',{
title: 'panel Parent',
id: 'parentID',
items: [
{
xtype: 'panel',
title: 'child panel',
id: 'childID',
itemId: 'childItemID'
}
]
});
you can select component using : Ext.getCmp('childID')
or Ext.getCmp('parentID').down('#childItemID');
As S Rifai suggested, you should use the relatively new EXT JS syntax for your components (introduced in the version 4,5 and 6) rather than the EXT JS 3 syntax.
Nonetheless Ext.getCmp('myComponentId').destroy();
works. You made a typo in your code at this line :
Ext.getCmp('id').destroy();
'id'
is the name of the tag, replace it with its value : 'panel-117'
Ext.getCmp('panel-117').destroy();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.