View Full Version : [CLOSED] [4.2.1] Charting and drawing - add me argument to fireEvent

20 Sep 2013, 5:53 AM
I wanted to point out that many drawing and charting events are not consistent with other components.

You will notice whenever fireEvent is called inside an Ext JS component, the first argument is the component that fired the event. However, in the drawing and charting package this is not always the case.

Why is this a problem? It's a problem because inside the controller there's no way to access to the component that fired the event.

this inside the event handler in the controller is the controller, not the object that fired the event.

If you set up event listeners in the component via the 'listeners' config, this in the component's event handler will be the component.

One such instance was fixed in 4.2.2, but there are more, see this (http://www.sencha.com/forum/showthread.php?264686-4.2.1-Series-pass-missing-series-param-in-the-afterrender-event)

Also, please don't forget about this bug (http://www.sencha.com/forum/showthread.php?192906-Sprite.destroy-use-the-hasListeners-optimization).

Ext.define('Ext.draw.Sprite', {
destroy: function() {
var me = this;
if (me.fireEvent('beforedestroy', me) !== false) {
me.fireEvent('destroy'); // <-- add me arg

Ext.define('Ext.AbstractComponent', {
destroy : function() {
if (me.hasListeners.destroy) {
me.fireEvent('destroy', me); // <-- here we have me

Gary Schlosberg
20 Sep 2013, 3:51 PM
Thanks for the report! I have opened a bug in our bug tracker.