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
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
You should probably post a short test case that demonstrates the issue, just so everyone is clear.
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.
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.
@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; } },
I am experiencing this also. When using setActiveItem on a Carousel component, the activate listener fires twice on the target item.
I am experiencing this as well.
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,
I'm having this same problem. Spooky.
Same problem here, anyone?
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});