Results 1 to 4 of 4

Thread: Component creation multiple times

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Paris, France
    Posts
    52
    Answers
    1
    Vote Rating
    0
      0  

    Default 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

  2. #2
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Answers
    64
    Vote Rating
    20
      0  

    Default

    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.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Paris, France
    Posts
    52
    Answers
    1
    Vote Rating
    0
      0  

    Default

    This isn't working... can't do a Ext.getCmp on it.

  4. #4
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Answers
    64
    Vote Rating
    20
      0  

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •