Creating a simple sencha listview using a loop

Posted by chris_sencha on Stack Overflow See other posts from Stack Overflow or by chris_sencha
Published on 2014-05-31T15:01:46Z Indexed on 2014/05/31 15:25 UTC
Read the original article Hit count: 162

Filed under:
|

How do we substitute a hardcoded data with a for loop in sencha and extjs?

Say, I have below hardcoded one

Ext.application({


    launch: function() {

        Ext.create('Ext.List', {
            fullscreen: true,
            itemTpl: '{title}',
            data: [{
                title: 'Item 1'
            }, {
                title: 'Item 2'
            }, {
                title: 'Item 3'
            }, {
                title: 'Item 4'
            }]
        });

    }
});

In the above one, how to replace data to something like below

Ext.application({
    launch: function() {

       Ext.create('Ext.List', {
            fullscreen: true,
            itemTpl: '{title}',
            data: [
               for(int i=0;i<5;i++){
                  {title: 'Item '+i}, 
               }
              ]
        });

    }
});

© Stack Overflow or respective owner

Related posts about extjs

Related posts about sencha-touch