1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    63
    Answers
    1
    Vote Rating
    1
    stevanicus is on a distinguished road

      0  

    Default Unanswered: Destroying and creating new panels

    Unanswered: Destroying and creating new panels


    Hi there,

    What is the best method of destroying and creating panels?

    I have a "wrapper" panel which dynamically loads its items via an array

    Code:
    var myItems = [];
    myItems.push(Ext.create("App.view.Grid1"));
    myItems.push(Ext.create("App.view.Grid2"));
    
    var Mypanel = Ext.create("App.view.Mypanel", {
        dynamicItems:myItems
    });
    
    mywrapperpanel.insert(0, Mypanel);
    Mypanel extends Ext.panel.Panel

    and has an initComponent similar to

    Code:
    initComponent:function(){
    
        if(this.dynamicItems){
            this.items[0] = this.dynamicItems[0];
            this.items[1] = this.dynamicItems[1];
         }
    }
    This all works absolutely fine (the first time) until I want to add new items to my panel by

    Code:
    mywrapperpanel.removeAll()
    
    ---> get new "myItems"
    
    var Mypanel = Ext.create("App.view.Mypanel", {
        dynamicItems:myItems
    });
    
    mywrapperpanel.insert(0, Mypanel);
    The error I then get is:

    Code:
    Error: el is nullext-all-dev.js (line 11108)
    
    
    TypeError: me.el is null
    
    [IMG]chrome://firebug/content/blank.gif[/IMG] me.container = Ext.get(me.el.dom.parentNode);ext-all-dev.js (line 38342)
    "me" is the first (non specific) item in the array "myItems". me doesnt not have el or a container hence the failure.


    Thanks in advance

  2. #2
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    63
    Answers
    1
    Vote Rating
    1
    stevanicus is on a distinguished road

      0  

    Default Answer

    Answer


    Found the answer,

    in the initComponent function the items need to be added after this.callParent() is called


    Code:
    initComponent:function(){
            this.callParent();
            if(this.dynamicItems){
                this.items.add(this.dynamicItems[0]);
                this.items.add(this.dynamicItems[1]);
            }
        }
    Then you don't have the problem with me.el is null

  3. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Answers
    656
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Thank you for the follow up.

    Scott.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi