PDA

View Full Version : [FIXED-EXTJSIV-1767] ActionColumn handler bug



gustavofranco
17 May 2011, 10:12 AM
Hi!

I found something that seems to be a bug.
When ActionColumns is used, I can implement a handle method on itself or on its items.
When the handle method is put on the ActionColumn object I get an error saying "fn is not defined".

Debugging I figure out that the error occur in this method (Ext.grid.column.Action, line 77336):





processEvent : function(type, view, cell, recordIndex, cellIndex, e){ var m = e.getTarget().className.match(this.actionIdRe),
item, fn;
if (m && (item = this.items[parseInt(m[1], 10)])) {
if (type == 'click') {
fn = item.handler;
if (fn || this.handler) {
fn.call(item.scope||this.scope||this, view, recordIndex, cellIndex, item, e);
}
} else if ((type == 'mousedown') && (item.stopSelection !== false)) {
return false;
}
}
return this.callParent(arguments);
},



The problem is more specifically in this piece of code:



fn = item.handler;
if (fn || this.handler) {
fn.call(item.scope||this.scope||this, view, recordIndex, cellIndex, item, e);
}



This code verify if it is to use the handler of the item or the handler of the ActionColumn, but it always using the handler of the item.
I think the correct should be something like this:



fn = item.handler || this.handler;
if (fn) {
fn.call(item.scope||this.scope||this, view, recordIndex, cellIndex, item, e);
}


Gustavo.

aconran
17 May 2011, 11:12 AM
Thanks for the bug report, this has already been fixed and will be in the 4.0.1 release.