-
14 Oct 2012 6:18 AM #1
Unanswered: Component creation multiple times
Unanswered: Component creation multiple times
Hi guys,
I'm facing an issue with my viewport.
I'm trying to destroy an element that could appear back later, but an error occurs at this second instance.
Code:Ext.getCmp('superMain').destroy(); Ext.Viewport.add(Ext.create('myapp.view.Log'));
Then later
Code:Ext.getCmp('superLog').destroy(); Ext.Viewport.add(Ext.create('myapp.view.Main')); // id=superMain (destroyed before)
Can't go further...
[WARN][Ext.Component#constructor] Registering a component with a id (`superMain`) which has already been used. Please ensure the existing component has been destroyed (`Ext.Component#destroy()`.
Hope someone can help me
Thanks a lot
-
14 Oct 2012 7:59 AM #2
Do not use 'id' , your component is not a singleton (you create ,destroy and create again).
Code:Ext.Viewport.add(Ext.create('myapp.view.Main',{itemId:'superMain'})); Ext.Viewport.getComponent('superMain').destory(); Ext.Viewport.add(Ext.create('myapp.view.Log',{itemId:'superLog'})); Ext.Viewport.getComponent('superLog').destroy(); Ext.Viewport.add(Ext.create('myapp.view.Main',{itemId:'superMain'}));I write English by translator.
-
14 Oct 2012 10:43 AM #3
This isn't working... can't do a Ext.getCmp on it.
-
14 Oct 2012 10:52 AM #4
what's you mean? why you use Ext.getCmp?
I have tested it,only a spell error on my code.(destory ---> destroy )I write English by translator.


Reply With Quote