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,637
    Answers
    613
    Vote Rating
    400
    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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar