PDA

View Full Version : [CLOSED] FeatureRequest: Ext.Carousel.setActiveIndex



tfjjones
17 Nov 2011, 4:30 PM
REQUIRED INFORMATION Ext version tested:

Sencha Touch 2.0 PR2

Browser versions tested against:

Not Applicable

DOCTYPE tested against:

Not Applicable

Description:

Currently Ext.Carousel has the following functions:
getActiveItem
setActiveItem
getActiveIndex
There is no setActiveIndex to match the getter. This makes navigating by index more hassle than it needs to be.


Steps to reproduce the problem:

Try and call setActiveIndex( int ) on an Ext.Carousel

The result that was expected:

Carousel switches to the item at index int

The result that occurs instead:

Error because no such function exists

Test Case:

Not Applicable

HELPFUL INFORMATION Screenshot or Video:

Not Applicable

Debugging already done:

Not Applicable

Possible fix:

Add a setActiveIndex function to Ext.Carousel

Additional CSS used:

Not Applicable

Operating System:

Not Applicable

Jamie Avins
18 Nov 2011, 9:03 AM
This has already been implemented for the next release.

conrad.decker
21 Nov 2011, 6:33 AM
Is there anyway to get a temporary patch until the next release?

oddz
21 Nov 2011, 9:10 AM
This is not tested but something like the below will probably do it.



Ext.define('App.carousel.CarouselOverride',{
override: 'Ext.carousel.Carousel',

setActiveIndex: function(index) {

var

cards = this.getInnerItems();

if(cards[index]) {
this.setActiveItem(cards[index]);
}

}

});

conrad.decker
21 Nov 2011, 10:41 AM
Ah, very cool. I didn't know you could override like that. I'll give it a shot.

Thanks Oddz.