-
30 Jun 2010 1:05 AM #1
Keeping track of Carousel pages
Keeping track of Carousel pages
I am moving the Carousel pages using two buttons in the toolbar.
While doing that, I am keeping a page count.
Now my problem is, if I move pages using gesture, I am not able to keep track of the pages.
I would like to know how can I tell my javascript when a page has been changed using gesture.
Is this possible?
-
30 Jun 2010 7:25 AM #2
Once again answering myself

'cardswitch' event did the job.
I must say the API is well documented, although it would help to have some examples in it.
Keep up the good work guys, we are with you
-
30 Jun 2010 9:40 AM #3Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Haarlem, Netherlands
- Posts
- 1,235
- Vote Rating
- 5
Thanks. Just wanted to tell you that in the new release the Carousel has been refactored and improved drastically. The cardswitch event is still there so your code should still work.
p.s. Please keep answering your own questions
-
8 Jul 2010 4:55 AM #4
hello folks...
Maybe a stupid question but i am new to Ext and Sencha ... cann you please tell me how to implement the listener?
can't get it to work ...Code:car.on('cardswitch', onCardSwitch); function onCardSwitch(c){ console.log('lalala: '+c); }
thanks in advance
quarkus
-
8 Jul 2010 4:59 AM #5
Try:
Code:car.on('cardswitch', function(){ console.log('foo'); });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
8 Jul 2010 5:08 AM #6
hmmm ... does not work either ...
i am doing all my stuff in the Ext.setup() method.
thanks for the quick reply !Code:Ext.setup({ icon: 'icon.png', glossOnIcon: false, onReady: function() { var videoRight = new Ext.Video(/*params*/); var videoLeft = new Ext.Video({/*params*/}); var car = new Ext.Panel({ cls: 'cards', fullscreen: true, layout: { type: 'vbox', align: 'left' }, defaults: { activeItem:1, flex: 1 // indicator:false }, items: [{ xtype: 'carousel', items: [ videoLeft , { id:'center', cls: 'cards card2' }, videoRight ] }], listeners:{ afterrender:function(c){ console.log('active is: '+c.activeSlide); } } }); car.on('cardswitch', function(){ console.log('foo'); }); } });
btw. am using version:"0.9.1"
quarkus
-
8 Jul 2010 5:17 AM #7
Because "car" doesn't have a layout of type card, so it never fires the cardswitch.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
8 Jul 2010 5:23 AM #8
ok ... that makes sense ...
changed my layout to this:
anything else ? cause it is still not working ... dunno what i messed up again.Code:layout: { type: 'card' }
thanks
-
13 Jul 2010 10:28 AM #9Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Haarlem, Netherlands
- Posts
- 1,235
- Vote Rating
- 5
You have only put 1 card in your car panel, so it will never switch. If you want to listen to the cardswitch event, you have to add the listener to the Carousel.
-
13 Jul 2010 10:50 AM #10
jep ....
found the solution but forgot to post the code.
first thing tomorrow.
thanks a lot.
Similar Threads
-
How to move Carousel pages using button click
By ssdesign in forum Sencha Touch 1.x: DiscussionReplies: 5Last Post: 1 Jul 2010, 11:49 PM -
[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 -
Keeping track of position and scroll
By sz_146 in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 16 Jan 2009, 9:21 AM -
Keeping livesearch value on subsequent pages of a grid
By matevans in forum Ext 2.x: Help & DiscussionReplies: 3Last Post: 7 Nov 2008, 8:15 AM


Reply With Quote
