SunboX
28 Oct 2011, 1:24 AM
Ext version tested:
Sencha Touch 2.0PR1
Browser versions tested against:
Safari 5.1 (7534.50) on Windows
Description:
I have an Ext.Carousel instance with dynamically added cards. I added 4 different(!) cards. If i listen to the "activeitemchange" event and console.log() the Ext.Carousel.getActiveIndex() value, I get this:
1
0
1
2
That´s wrong! This is what I expected:
0
1
2
3
Test Case:
Ext.setup({
onReady: function() {
var self = this;
var carousel = Ext.create('Ext.Carousel', {
fullscreen: true,
defaults: {
styleHtmlContent: true
},
items: [
{
html : 'Item 1',
style: 'background-color: #5E99CC'
},
{
html : 'Item 2',
style: 'background-color: #759E60'
},
{
html : 'Item 3'
},
{
html : 'Item 4',
style: 'background-color: #759E60'
},
]
});
carousel.on({
activeitemchange: function(carousel){
var activeIndex = carousel.getActiveIndex();
console.log(activeIndex);
}
});
var first = carousel.getInnerItems()[0];
if(first)
carousel.setActiveItem(first);
}
});
HELPFUL INFORMATION
See this URL for live test case:
http://jsfiddle.net/QYJpc/16/ (open with Safari!)
greetings Sunny
Sencha Touch 2.0PR1
Browser versions tested against:
Safari 5.1 (7534.50) on Windows
Description:
I have an Ext.Carousel instance with dynamically added cards. I added 4 different(!) cards. If i listen to the "activeitemchange" event and console.log() the Ext.Carousel.getActiveIndex() value, I get this:
1
0
1
2
That´s wrong! This is what I expected:
0
1
2
3
Test Case:
Ext.setup({
onReady: function() {
var self = this;
var carousel = Ext.create('Ext.Carousel', {
fullscreen: true,
defaults: {
styleHtmlContent: true
},
items: [
{
html : 'Item 1',
style: 'background-color: #5E99CC'
},
{
html : 'Item 2',
style: 'background-color: #759E60'
},
{
html : 'Item 3'
},
{
html : 'Item 4',
style: 'background-color: #759E60'
},
]
});
carousel.on({
activeitemchange: function(carousel){
var activeIndex = carousel.getActiveIndex();
console.log(activeIndex);
}
});
var first = carousel.getInnerItems()[0];
if(first)
carousel.setActiveItem(first);
}
});
HELPFUL INFORMATION
See this URL for live test case:
http://jsfiddle.net/QYJpc/16/ (open with Safari!)
greetings Sunny