Saturday, 4 May 2013

How to add Dynamic Items to Ext.carousel.Carosel In sencha Touch

A Small Example for  Sencha touch Carousel, How to Add Dynamic Items to the Carousel .

In the Below Code is the Carousel for 3 Items of Normal way of Writing in the Sencha Touch.



  Ext.create('Ext.Carousel', {
                fullscreen: true,
                id: 'AddingDynamicItems',
                items: [
                        {
                            html : 'Item 1',
                        },
                        {
                            html : 'Item 2',
                        },
                        {
                            html : 'Item 3'
                        }
                     ]
                });

To add these above carousel Items  Data Dynamically, add the listeners and do Your Logic,
See the Following Sample Code.


             listeners:
                {
                    'initialize': function( me, eOpts ) {
                          for (i=1; i<=3; i++) {
                                me.add({
                                 html : 'Item ' + i
                                 //add your Logic.
                                  });
                           }
                        }
                    }


No comments:

Post a Comment