-
4 Jan 2011 9:49 PM #1
Activate event fires twice - why?
Activate event fires twice - why?
I'm listening out for the activate event, which I use to append a few items. Console logging in Safari shows me the activate event fires twice, thus appending my items twice. Why is it doing this? I'm using 1.0.2.
Thanks
-
4 Jan 2011 11:46 PM #2
You should probably post a short test case that demonstrates the issue, just so everyone is clear.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
5 Jan 2011 9:14 AM #3
I have to run in a few minutes, but very quickly, thank you for the reply.
My application is MVC. I have an Ext.Panel with card layout (called viewport and I will refer to it as such from now on) defining the important sections of my application. These sections are all panels with other controls called within and are controlled via routes calling different controllers.
When I set a new active item (one of my various section panels) on my viewport, I listen for the activate event and it is then that it fires twice. This occurs on multiple panels and I have determined that that even a simple panel with nothing but some HTML in it will fire the activate event twice. Hope this helps.
-
5 Jan 2011 11:41 AM #4
@evant
It looks like when the panel is layed out for the first time an event for activate is called, then also when setActiveItem is called. Is this the expected behaviour?
Code:Ext.layout.CardLayout = Ext.extend(Ext.layout.FitLayout, { type: 'card', sizeAllCards: false, hideInactive: true, beforeLayout: function() { this.activeItem = this.getActiveItem(); return Ext.layout.CardLayout.superclass.beforeLayout.apply(this, arguments); }, onLayout: function() { Ext.layout.FitLayout.superclass.onLayout.apply(this, arguments); var activeItem = this.activeItem, items = this.getLayoutItems(), ln = items.length, targetBox = this.getTargetBox(), i, item; for (i = 0; i < ln; i++) { item = items[i]; this.setItemBox(item, targetBox); } if (!this.firstActivated && activeItem) { if (activeItem.fireEvent('beforeactivate', activeItem) !== false) { activeItem.fireEvent('activate', activeItem); } this.firstActivated = true; } },
-
14 Mar 2011 10:18 AM #5
Any resolution?
Any resolution?
I am experiencing this also. When using setActiveItem on a Carousel component, the activate listener fires twice on the target item.
-
15 Jun 2011 7:49 AM #6
-
3 Dec 2011 9:06 PM #7
The last post on this seems to have been awhile ago. I'm also experiencing this, has anyone figured out why it is happening and/or how to stop it?
Cheers,
-
22 Feb 2012 9:51 AM #8
I'm having this same problem. Spooky.
-
1 Mar 2012 10:24 AM #9
Same problem here, anyone?
-
26 Mar 2012 1:28 PM #10
Same problem still here. Isn't this like major flaw? Workaround within panel is to set buffer:
This solves the problem when running actions from panel, but in new MVC model one should set all the actions in controller and controller only. I have no idea how to set buffer on function in controller. If anyone knows how to set buffer on function in controller please let me know.Code:this.on('activate',function(){ alert('activated'); },this,{buffer:100});
Similar Threads
-
Card Layout Activate Event
By parky128 in forum Ext 3.x: Help & DiscussionReplies: 8Last Post: 12 Jul 2010, 10:17 AM -
Activate Event Firing
By timw in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 7 Apr 2010, 1:08 PM -
tab activate event help
By MoShAn480 in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 10 Sep 2008, 3:27 AM -
activate event
By Silent79 in forum Ext 2.x: Help & DiscussionReplies: 12Last Post: 26 Nov 2007, 3:54 PM -
Activate event in ContentPanel and gridPanel?
By franklt69 in forum Ext 1.x: Help & DiscussionReplies: 0Last Post: 10 Feb 2007, 12:23 PM


Reply With Quote