Results 1 to 3 of 3

Thread: how to do dynamic items: [ ]

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    30
    Vote Rating
    0
      0  

    Default Answered: how to do dynamic items: [ ]

    my view class looks something like this

    Code:
    Ext.define('tmp.view.Myclass, {
    extends: 'Ext.Panel',
    config: {
    items: [
    {
    html: 'part 1',
    },
    {
    html: 'part 2',
    },
    ]
    }
    });
    i would like to do this in a such. so that i do not have to manually put html: 'part #' one by one. is this possible?

  2. Code:
    {
    config:{//....},
    initialize: function() {
            var me = this,i;
            me.callParent();
            for(i=0;i<2;i++){
               me.add({
                  html: 'part '+i
               });
            }
    }
    }

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

    Default

    Code:
    {
    config:{//....},
    initialize: function() {
            var me = this,i;
            me.callParent();
            for(i=0;i<2;i++){
               me.add({
                  html: 'part '+i
               });
            }
    }
    }

  4. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    30
    Vote Rating
    0
      0  

    Default

    thank you haduki! this worked!

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
  •