Grid cell events?
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 (ie 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 );
},
链接地址: http://www.djcxy.com/p/67638.html
上一篇: .on('click')与.click()之间的区别
下一篇: 网格单元格事件?