You found a bug! We've classified it as TOUCH-3663 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    334
    Vote Rating
    15
    jweber will become famous soon enough

      0  

    Default activeitemchange event order different in view/controller

    activeitemchange event order different in view/controller


    REQUIRED INFORMATION


    Ext version tested:
    • Sencha Touch 2.1b1, 2,1rc2

    Browser versions tested against:
    • Chrome 22.0.1229.94

    DOCTYPE tested against:
    • html

    Description:
    • When I set an activeitemchange listener on a carousel, if I set it from a controller, it fires before the activeItem is changed. But if I set it on the view itself, it fires after the activeItem is changed.

    Steps to reproduce the problem:
    • Load the code below, and swipe to the left.

    The result that was expected:
    • Both listeners log the same value to the console, to indicate that they both were called before or after the activeItem changed.

    The result that occurs instead:
    • The controller's listener logs "false", and the view's listener logs "true".
      Code:
      activeitemchange from controller: false
      activeitemchange from view: true

    Test Case:

    Code:
    Ext.define('Test.view.MyCarousel', {
    	extend: 'Ext.carousel.Carousel',
    	xtype: 'myCarousel',
    	config: {
    		fullscreen: true,
    		items: [{
    			itemId: 'a',
    			html: 'a'
    		}, {
    			itemId: 'b',
    			html: 'b'
    		}, {
    			itemId: 'c',
    			html: 'c'
    		}],
    		listeners: {
    			activeitemchange: function(carousel, value, oldValue, eOpts) {
    				console.log('activeitemchange from view:', value === carousel.getActiveItem());
    			}
    		}
    	}
    });
    
    Ext.define('Test.controller.MyController', {
    	extend: 'Ext.app.Controller',
    	config: {
    		control: {
    			'myCarousel': {
    				activeitemchange: 'onCarouselChange'
    			}
    		}
    	},
    	onCarouselChange: function(carousel, value, oldValue, eOpts) {
    		console.log('activeitemchange from controller:', value === carousel.getActiveItem());
    	}
    });
    
    Ext.application({
    	name: 'Test',
    	controllers: ['MyController'],
    	views: ['MyCarousel'],
    	launch: function() {
    		Ext.create('Test.view.MyCarousel');
    	}
    });


    HELPFUL INFORMATION


    Screenshot or Video:
    • N/A

    See this URL for live test case: N/A


    Debugging already done:
    • none

    Possible fix:
    • not provided

    Additional CSS used:
    • only default ext-all.css

    Operating System:
    • Mac OS 10.8

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.