-
22 Jun 2012 11:36 PM #1
Unanswered: Avoid: Registering duplicate id "XYZ" with this manager
Unanswered: Avoid: Registering duplicate id "XYZ" with this manager
Hi,
I have small issue here,
My senior team menber is creating a widget inside the panel as below
Ext.getCmp('selectedopptionsId').add(Ext.widget('selectedprimary'));
but when i use the same page and create another Ext.widget('selectedprimary') i see in console
Uncaught Ext.Error: Registering duplicate id "primarywantid" with this manager
Please let me know the correct way to see if the widget is already created, and i can use the same.....
-
22 Jun 2012 11:40 PM #2Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,075
- Vote Rating
- 97
- Answers
- 168
There's nothing special about it. If you register it once, you can't use it again, id's needs to be unique across the app.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
22 Jun 2012 11:54 PM #3
Confused...
Confused...
Nope i dint get that..
Please clarify more on this..
My requirement is:
Say i have 2 buttons, on button 1 action i am adding widget "xyz" to my panel1.
Ext.getCmp('panel1').add(Ext.widget('xyz'));and say button 2 action again adding widget "xyz" to my panel1.
Ext.getCmp('panel1').add(Ext.widget('xyz'));
if i have clicked button1 and click on button 2 i am seeing thisUncaught Ext.Error: Registering duplicate id "primarywantid" with this manager.
Please clarify,
Thanks,
Punith
-
23 Jun 2012 12:03 AM #4Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,075
- Vote Rating
- 97
- Answers
- 168
Exactly that. If you specify an id on the class definition:
You're going to end up with duplicate id's. Don't do that.Code:Ext.define('Foo', { id: 'x' }); var a = new Foo(); var b = new Foo();Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!


Reply With Quote