javascriptextjs4.1extjs-mvc

How to get extjs grid cell component


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.


Solution

  • 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 )