PDA

View Full Version : Activate Listener fires twice



JeffBurr
14 Mar 2011, 12:07 PM
When you use setActiveItem on a Carousel to move to a specific card, the Activate event fires twice.

Is there a workaround for this, and/or is this a known bug?

JeffBurr
14 Mar 2011, 1:24 PM
You can see this in action. In the examples/carousel2 folder of 1.02, add/replace the following at line 52 of index.js



html: rec.get('content'),
cls: 'card ' + rec.get('cls'),
listeners: {
activate: function(){
console.log(rec.internalId);
}
}


You can see in the console that when you swipe, the event only fires once, but when you use the buttons (which is setActiveItem) it fires twice.

Thanks for any help!

venumobile
15 Mar 2011, 11:09 AM
I'm experiencing this also.

JeffBurr
17 Mar 2011, 6:30 AM
Is there some reason that this is being ignored by Sencha support?

I would just like an answer as to whether there is a work-around, or if a fix will be coming in the future.

tuongaz
26 Apr 2011, 3:20 PM
Has anyone had the answer?

AlexKorn
22 May 2011, 2:54 PM
I am also experiencing this. After looking into the Card Layout's setActiveItem() code, I decided I'd leave a proper fix up to the Sencha dev team :)

Here is my workaround:



this.on('activate', function() {
/*
* The activate listener fires twice, so ignore it if it's
* recently fired
*/
if (me.ignoreActivate) {
return;
}
me.ignoreActivate = true;
ext.defer(function() {
me.ignoreActivate = false;
}, 1000);

// put the rest of your activation code here
});


By the way, this thread is about the same issue: http://www.sencha.com/forum/showthread.php?120243-Activate-event-fires-twice-why

interfasys
4 Jun 2011, 4:10 PM
Is this only a problem with the carousel?
I don't see this with tabpanels.

chitgoks
26 Sep 2012, 6:20 PM
i also encountered this with Ext.dataview.List