-
22 Feb 2011 6:38 AM #1
Dynamic carousel
Dynamic carousel
Hi! Just started with models by following the MVC tutorial, so I ended up with this list:
But I've tried for like an hour now to transform this into a carousel, can anyone give me a hand?Code:expolinc.views.ProductsList = Ext.extend(Ext.Panel, { dockedItems: [{ xtype: 'toolbar', title: 'Products' }], items: [{ xtype: 'list', store: expolinc.stores.products, itemTpl: '{name} {imagesrc}', onItemDisclosure: function (record) { Ext.dispatch({ controller: expolinc.controllers.products, action: 'show', id: record.getId() }); } }], initComponent: function() { expolinc.stores.products.load(); expolinc.views.ProductsList.superclass.initComponent.apply(this, arguments); } });
Thanks!
-
22 Feb 2011 10:21 AM #2
How do you want to change this into a carousel? A carousel has an item per page.
from the docs:
http://dev.sencha.com/deploy/touch/docs/
You could use the initComponent overloading and the Carousel's add function to add components to from the store.Code:var carousel = new Ext.Carousel({ items: [ { html: '<p>Navigate the carousel on this page by swiping left/right.</p>', cls : 'card card1' }, { html: '<p>Clicking on either side of the indicators below</p>', cls : 'card card2' }, { html: 'Card #3', cls : 'card card3' } ] });
i.e.
Code:initComponent:function(){ ... var me = this; expolinc.stores.products.each(function(item){ me.add({html:'<div>'+item.name+'</div>'}); }); me.doComponentLayout(); }
-
22 Feb 2011 10:31 AM #3
Yes, I know that the Carousel has items, so does the list. Therefore, the list items becomes carousel items
Will try your code and get back to you. Thanks!
-
4 Dec 2011 2:19 AM #4
Hi i've tried this exemple it did not worked. in another hand it does work when i put it with an event triggerCode:initComponent:function(){ ... var me = this; expolinc.stores.products.each(function(item){ me.add({html:'<div>'+item.name+'</div>'}); }); me.doComponentLayout(); }
but i don't wana do it on 'show' event, i need to do it only one time when the view is created.Code:this.on('show', function() { var me = this; ... });
thanks !
-
12 Dec 2011 1:28 PM #5
Probably missing the myComponent.superclass.initComponent.apply(this,arguments)
Similar Threads
-
'Pulse' like interface - carousel in carousel
By TrentMav in forum Sencha Touch 1.x: Examples and ShowcasesReplies: 5Last Post: 10 Feb 2012, 1:59 AM -
Problem with dynamic carousel
By Shijutv in forum Sencha Touch 1.x: DiscussionReplies: 4Last Post: 10 Nov 2011, 4:53 PM -
Create Carousel with dynamic data
By sj_tt6 in forum Sencha Touch 1.x: DiscussionReplies: 1Last Post: 18 Nov 2010, 11:49 AM -
Broken in 1.0RC? Carousel with dynamic card content used to work until 1.0RC
By mnjacobs in forum Sencha Touch 1.x: DiscussionReplies: 3Last Post: 10 Nov 2010, 9:46 AM -
[OPEN] [FIXED-110] Carousel indicator breaks down after changing carousel content.
By Mphasize in forum Sencha Touch 1.x: BugsReplies: 6Last Post: 1 Jul 2010, 11:41 AM


Reply With Quote