PDA

View Full Version : Extjs3.4: Get reference of column causing requested action



nikita.navale
30 Jun 2014, 1:24 AM
Hi,
With extjs 3.4, I have put up a grid which has an action column. In my business logic, I need to perform actions on cellClick based on calling entity. Herein, one of the checks is to identify whether the calling entity is the defined action column.
I have tried several different approaches to handle this, but non has worked so far.
For eg: getting column reference from grid and getting its header from thereCode:
var colObj = grid.getColumnModel().getColumnAt(colIndex);
var colHeader = grid.getColumnModel().getColumnHeader(colObj);This gets me the header, but due to some business logic it is overridden and this doesn't work.
Same with setting the ID. Is there any other way to get through this?
Following is my snippet for column definition:
Code:
myVar = new Ext.grid.ActionColumn({
width : 50,
items : [{
getClass : function(v, meta, rec) {
var retVal = 'add-col';
... //if-else conditions to set retVal
return retVal;
},
handler : function(grid, rowIndex, colIndex) {
if(multiCreate) {
executeMultiAddAction(grid, rowIndex, colIndex);
} else {
executeGeneralAction(grid, rowIndex, colIndex);
}
}
}]
});
.........
var selectionGrid = new Ext.psl.grid.GridPanel({
..listeners:{
...cellclick: function(grid, rowIndex, colIndex, evt){
var colObj = grid.getColumnModel().getColumnAt(colIndex);
var colHeader = grid.getColumnModel().getColumnHeader(colObj);
if(/*condition to check if called by actionColumn*/){
//do something
} else {
//i.e. when selected col is not action column- execute custom logic
}
}
}
});It would be a great help if I can get any direction.
Thanks,
Nikita