javascriptuser-interfaceextjssencha-architect

Extjs- Fire the handler of an action column in grid


I have defined a grid and i have an action element in every row of the grid to delete that row. Is there a way to fire the handler of that action element in first row without clicking from UI.

{
 xtype: 'actioncolumn',
 text: "Delete Me,
 items: [{ 
    iconCls: 'x-fa fa-trash',
    tooltip: "Delete",
    handler: 'deleteGridRec',
  }} 
}

Solution

  • Let colIdx is the index of your action column and grid is the grid contain this column. Then below code to fire the handler of that action element in first row.

    deleteGridRec(grid,0,colIdx);
    

    or use

    actionColumn.items[0].handler(grid.up('grid'),0,colIdx);
    

    where actionColumn variable contains action column for row deletion.