PDA

View Full Version : [OPEN] activeitemchange event order different in view/controller



jweber
5 Nov 2012, 3:53 PM
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".

activeitemchange from controller: false
activeitemchange from view: true

Test Case:


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

mitchellsimoens
6 Nov 2012, 5:08 AM
Thanks for the report! I have opened a bug in our bug tracker.