-
15 Jun 2012 3:40 PM #1
Carousel getActiveItem returns NULL
Carousel getActiveItem returns NULL
Carousel was just created with a single item containing some html text. Calling getActiveItem returns NULL. Seems like it should return the item it is displaying.
-
16 Jun 2012 4:13 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,654
- Vote Rating
- 434
Using 2.0.0, 2.0.1 and 2.0.1.1 it is returning the instance for me:
Code:var carousel = new Ext.carousel.Carousel({ fullscreen : true, items : [ { html : 'foo' } ] }); console.log(carousel.getActiveItem());Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
16 Jun 2012 10:42 AM #3
Too fast on the draw there.
This fails.
produces Active Item: undefinedCode:var carousel = new Ext.carousel.Carousel({ fullscreen : true, items: [{ xtype: 'label', html: 'No Images', centered: true }] }); console.log("Active Item: " + carousel.getActiveItem());
-
17 Jun 2012 8:19 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,654
- Vote Rating
- 434
That's because the centered config makes that item floating and therefor not an inner item. Only inner items can be active therefore getActiveItem will return null.
If you do this it will work:
Code:var carousel = new Ext.carousel.Carousel({ fullscreen : true, items : [ { xtype : 'label', html : 'No Images' } ] }); console.log('Active Item: ' + carousel.getActiveItem());Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
17 Jun 2012 2:06 PM #5
That is a pretty bizarre constraint. There are no warnings in the docs about this sort of thing at all.
-
17 Jun 2012 3:46 PM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,654
- Vote Rating
- 434
It's not really a constraint, same reason a docked item cannot be an active item.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
2 Nov 2012 9:56 AM #7
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote