In ExtJS 3.x the Grid Panel component had bindable events for cells including cellclick
, cellcontextmenu
, celldblclick
, and cellmousedown
, and listeners on these events were passed both the rowIndex
and colIndex
of the cell that fired the event.
In 4.x these events are gone, there are only item* events (i.e. itemclick
) but these events fire for the grids' rows as a whole and therefore are only passed the row's index.
Is there any way to determine which column was clicked using these events, or is there an alternate way of attaching listeners to the cells?
I think the key to your question lies in the Selection Model chosen for the grid. The default is row selector so the item select events operate on rows. Check out cell selector API here: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.selection.CellModel-event-select
(ExtJS 4.1)
You could also hook on the (undocumented) uievent
of the grid's view:
grid.getView().on( 'uievent', this.onUIEvent, this);
onUIEvent: function ( aType, aView, aCell, aRecordIndex, aCellIndex, aEvent )
{
console.log( aRecordIndex + ' : ' + aCellIndex );
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With