-
4 Jul 2012 4:33 AM #1
Answered: carousel.destory() fires activeitemchange event
Answered: carousel.destory() fires activeitemchange event
How can I prevent the activeitemchange event from firing when I destroy a carousel component?
-
Best Answer Posted by mitchellsimoens
The reason this is happening is the Carousel has code that when an item is removed that is active it will make the previous item active which is then firing the activeitemchange. You could suspend events to stop the event from being thrown:
Code:new Ext.carousel.Carousel({ fullscreen : true, items : [ { html : 'One' }, { html : 'Two', items : [ { xtype : 'toolbar', docked : 'top', items : [ { text : 'Destroy Carousel', handler : function (button) { var carousel = button.up('carousel'); carousel.suspendEvents(); carousel.destroy(); } } ] } ] } ], listeners : { activeitemchange : function() { console.log('activeitemchange'); } } });
-
6 Jul 2012 4:36 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
The reason this is happening is the Carousel has code that when an item is removed that is active it will make the previous item active which is then firing the activeitemchange. You could suspend events to stop the event from being thrown:
Code:new Ext.carousel.Carousel({ fullscreen : true, items : [ { html : 'One' }, { html : 'Two', items : [ { xtype : 'toolbar', docked : 'top', items : [ { text : 'Destroy Carousel', handler : function (button) { var carousel = button.up('carousel'); carousel.suspendEvents(); carousel.destroy(); } } ] } ] } ], listeners : { activeitemchange : function() { console.log('activeitemchange'); } } });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.
-
9 Jul 2012 4:04 AM #3
"i
t will make the previous item active which is then firing the activeitemchange"
does this apply when the last carousel item gets deleted?


Reply With Quote