Search code examples
extjs3

unable to add panel inside another panel which already has panels as its item in Extjs 3


var len = panel.items.items.length;
if(len < 15){
panel.add(this.childPanel);
panel.doLayout();
}

// the items inside panel remains unchanged even after performing doLayout()


Solution

  • Problem was with the creation of childPanel. While creating child panel I made the id field of childPanel dynamic by giving an index to it.

     ChildPanel.superclass.constructor.call(this, {
        id : 'panel'+this.index,
        items : []
     });
    

    This way each childPanel created will have different ids.

    var len = panel.items.items.length;
    if(len < 15){
    panel.add(this.childPanel);
    panel.doLayout();
    }
    

    this code worked perfectly after that!