Iumentum
24 Jun 2010, 1:33 AM
In the carousel i got it works first time i .add() to it but 2nd time i do it it fails to use the .next() and .setActiveItem(). It is possible to use touch slide in the carousel and after doing that .next() and .setActiveItem() will also work.
Example of how i do:
var object = {};
for (var i = 0; i < array.length; i++) {
object = new Object(array[i].data);
object.html = tpl.applyTemplate(object);
carousel.add(new Object(playlist[i].data));
}
carousel.doLayout();
carousel.setActiveItem(0, true, true);
After above is done 2nd time .next() and .setActiveItem() will work for the length of 1st time.
I looked a bit in the source and debugged a bit and i can see that it doesn't update the scroller bounds.
Not 100% sure this is a bug or if i missed to do something, but i debugged a bit and looked for available carousel functions there should do the trick.
Edit: if i within the Ext.Carousel.afterLayout add this.scroller.updateBounds(); it does the trick :)
Kind regards
Ronni Rasmussen
Example of how i do:
var object = {};
for (var i = 0; i < array.length; i++) {
object = new Object(array[i].data);
object.html = tpl.applyTemplate(object);
carousel.add(new Object(playlist[i].data));
}
carousel.doLayout();
carousel.setActiveItem(0, true, true);
After above is done 2nd time .next() and .setActiveItem() will work for the length of 1st time.
I looked a bit in the source and debugged a bit and i can see that it doesn't update the scroller bounds.
Not 100% sure this is a bug or if i missed to do something, but i debugged a bit and looked for available carousel functions there should do the trick.
Edit: if i within the Ext.Carousel.afterLayout add this.scroller.updateBounds(); it does the trick :)
Kind regards
Ronni Rasmussen