-
1 Oct 2012 7:39 AM #1
Unanswered: extjs actioncolumn renderer prevents handler
Unanswered: extjs actioncolumn renderer prevents handler
I have a actioncolumn on my grid with this code:
this.columns =
[
{
xtype: 'actioncolumn',
items: [{
icon: '../Content/Images/Approve.png',
handler: function (grid, rowIndex, colIndex, node, e, record, rowNode) {
alert('test approve')
}
}
...rest of the columns
when I click the icon, I get the "test approve" message, so it works as expected!
If I add the render method bellow to disable the action column for rows that are already approved:
renderer: function (value, metadata, record) {
if (record.get('Approved') = 1) {
this.items[0].disabled = true
} else {
this.items[0].disabled = false;
}
}
the handler stops working on the enabled itens. It seems like the renderer function is preventing the handler to be called. I even tried to add the handler code inside the renderer, but also no success.
Any idea why this would happen?
-
13 Oct 2012 11:03 PM #2
Root of the behavior you seeing is the fact that ActionColumn is only one object. It uses the last value that been set when grid rendered, in your case last value of disabled was true and handler is not being called.
Version 4.1.2 has nice answer in isDisabled configuration parameter:
Code:this.columns = [ { xtype: 'actioncolumn', items: [{ icon: '../Content/Images/Approve.png', handler: function (grid, rowIndex, colIndex, node, e, record, rowNode) { alert('test approve') }, isDisabled: function (view, rowIndex, colIndex, item, record) { return record.get('Approved') == 1; } }] } ]


Reply With Quote