PDA

View Full Version : How to fire event in CONTROLS of controller in grid?



korndeang
14 May 2013, 10:50 PM
Hi all i got stuck with on any cell click on my grid, i have successful with actioncolumn, but in normal row i am no luck.
code work with actioncolumn:

{header: 'Date Created', dataIndex: 'date_created', flex: 1},
{header: 'By', dataIndex: 'created_by', flex: 1},//I want this column work like actioncolumn without use listener
{
xtype: 'actioncolumn',
width: 100,
sortable: false,
menuDisabled: true,
items: [{
margins: '0 0 2 0',
icon: 'js/Ext/resources/images/icon/edit.png',
tooltip: 'Edit',
handler : function(grid, rowIndex, colIndex, node, e, record, rowNode) {
this.fireEvent('editAccount', this, 'sell', grid, rowIndex, colIndex, record, node);
}
},{
margins: '0 0 2 0',
icon: 'js/Ext/resources/images/icon/delete.gif',
tooltip: 'Remove',
handler : function(grid, rowIndex, colIndex, node, e, record, rowNode) {
this.fireEvent('deleteAccount', this, 'sell', grid, rowIndex, colIndex, record, node);
}
}]
}
my controller:

'accountList actioncolumn':{
editAccount : this.editAccount,
deleteAccount: this.deleteAccount

}

tobiu
16 May 2013, 7:54 AM
If you are using a cell selection model, this is quite easy:
http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.selection.CellModel-event-select

Otherwise I would attach one click listener to the grid view and delegate it down on cell level.
Do not apply one listener for each cell.

Best regards
tobiu