Results 1 to 2 of 2

Thread: Add items dynamically to card layout

  1. #1
    Sencha User
    Join Date
    Dec 2007
    Posts
    12
    Vote Rating
    0
      0  

    Default Add items dynamically to card layout

    I have a card layout with no items:
    Code:
    Ext.define('AM.view.applications.FunctionWindow', {
        extend: 'Ext.window.Window',
        title: 'Example Wizard',
        width: 300,
        height: 200,
        layout: 'card',
        items: []    
    });
    I need to create dynamically some panels and add them to layout as cards.
    I tried adding the following code to initComponent function, but I have an error:
    Code:
          var p0 = Ext.create('Ext.panel.Panel', {
                id: 'card-0',
              title: 'Hello',
              width: 200,
              html: '<p>World!</p>'
          });
          this.add(p0); // -----> ERROR
          // this.items.add(p0); // --------> ERROR
    The error is:
    TypeError: me.items.insert is not a function

    Where is the problem?
    How can I add a panel dynamically to card layout?

    Thank you
    bye
    stefano

  2. #2
    Sencha User
    Join Date
    Jun 2012
    Location
    India
    Posts
    50
    Answers
    4
    Vote Rating
    3
      1  

    Default

    stefano,
    It seems you are not doing this.callParent(arguments) in the initComponent function. Please try with the below code.

    Code:
    initComponent : function(){
    this.callParent(arguments);
    var p0 = Ext.create('Ext.panel.Panel', { 
                 id: 'card-0', 
                 title: 'Hello', 
                 width: 200,
                 html: '<p>World!</p>' 
                });
     this.add(p0);
    }
    

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
  •