1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    64
    Answers
    2
    Vote Rating
    0
    punith.mailme is on a distinguished road

      0  

    Default 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.....

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,003
    Answers
    464
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    64
    Answers
    2
    Vote Rating
    0
    punith.mailme is on a distinguished road

      0  

    Default 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 this
    Uncaught Ext.Error: Registering duplicate id "primarywantid" with this manager.

    Please clarify,
    Thanks,
    Punith

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,003
    Answers
    464
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Exactly that. If you specify an id on the class definition:

    Code:
    Ext.define('Foo', {
        id: 'x'
    });
    
    var a = new Foo();
    var b = new Foo();
    You're going to end up with duplicate id's. Don't do that.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1

Tags for this Thread