2
votes

I want to get grid's cell and fire cellclick event on it programmatically. How can I implement it?So far I am successful to get cell's dom element like this

var cell = pos.view.getCellByPosition(newPos);

but when I execute the following code

cell.fireEvent('click');

it gives me error because its not Ext Component. Is there any way to get Ext Component from Dom Element. Dom element has an ID but when I use Ext.getCmp(cell.id); it returns nothing.

2

2 Answers

4
votes

Grid cell has no representation by an ExtJS component therefore you cannot fire event on it. It is possible fire manually DOM event for cell DOM element (http://jehiah.cz/a/firing-javascript-events-properly) or fire event itemclick for Ext.grid.View component.

0
votes

The cellclick event is actually fired from the underlying View, not the cell itself.

So try to fire the following event:

pos.view.fireEvent("cellclick")

You should fill the missing params, as cellclick should deliver the following:

cellclick( Ext.view.Table this, HTMLElement td, Number cellIndex,
           Ext.data.Model record, HTMLElement tr, Number rowIndex,
           Ext.EventObject e, Object eOpts )