1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    132
    Vote Rating
    0
    ssdesign is on a distinguished road

      0  

    Default 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?

  2. #2
    Sencha User
    Join Date
    Jun 2010
    Posts
    132
    Vote Rating
    0
    ssdesign is on a distinguished road

      0  

    Default


    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

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    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

  4. #4
    Ext User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    quarkus is on a distinguished road

      0  

    Question


    hello folks...
    Maybe a stupid question but i am new to Ext and Sencha ... cann you please tell me how to implement the listener?
    Code:
    car.on('cardswitch', onCardSwitch);
            function onCardSwitch(c){
        		console.log('lalala: '+c);            	
        	}
    can't get it to work ...

    thanks in advance
    quarkus

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,920
    Vote Rating
    632
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Try:

    Code:
    car.on('cardswitch', function(){
        console.log('foo');
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #6
    Ext User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    quarkus is on a distinguished road

      0  

    Default


    hmmm ... does not work either ...

    i am doing all my stuff in the Ext.setup() method.

    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');
            });
        }
    });
    thanks for the quick reply !

    btw. am using version:"0.9.1"

    quarkus

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,920
    Vote Rating
    632
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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. #8
    Ext User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    quarkus is on a distinguished road

      0  

    Default


    ok ... that makes sense ...
    changed my layout to this:
    Code:
    layout: {
                    type: 'card'
                }
    anything else ? cause it is still not working ... dunno what i messed up again.

    thanks

  9. #9
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    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.

  10. #10
    Ext User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    quarkus is on a distinguished road

      0  

    Default


    jep ....
    found the solution but forgot to post the code.

    first thing tomorrow.

    thanks a lot.

Similar Threads

  1. How to move Carousel pages using button click
    By ssdesign in forum Sencha Touch 1.x: Discussion
    Replies: 5
    Last Post: 1 Jul 2010, 11:49 PM
  2. [OPEN] [FIXED-110] Carousel indicator breaks down after changing carousel content.
    By Mphasize in forum Sencha Touch 1.x: Bugs
    Replies: 6
    Last Post: 1 Jul 2010, 11:41 AM
  3. Keeping track of position and scroll
    By sz_146 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 16 Jan 2009, 9:21 AM
  4. Keeping livesearch value on subsequent pages of a grid
    By matevans in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 7 Nov 2008, 8:15 AM

Thread Participants: 3