Extjs Grid cell click for popup window
Hi All,
I have got requirement like i have loaded my Ext grid with data. When i click on the perticular cell i should open window.showmodeldialog with that cell data to the popup and i can change that record data and i should refresh the parent grid for the updated data once i saved the popup data.
How to write the event to select the cell or column similar to
grid.on('click', this.gridSelectionHandler, this);
I will appriciate your early response as i need to finish this task early for the tommorow release.
Thanks,
Srikanth
CellClick Solution for Ext 4
In your grid constructor code:
Code:
this.on({cellclick: { fn:this.showPopup, scope: this });
Then put in these methods in your grid:
Code:
showPopup: function (grid,td,cellIndex,record,tr,rowIndex,e,eOpts) { var columnIndex = this.getColumnIndex(grid, 'YourCellColumnNameThatYouWantClicked'); if (cellIndex == columnIndex) { //you have a match...do your popup code here } }, getColumnIndex: function (grid, dataIndex) { var gridColumns = grid.headerCt.getGridColumns(); for (var i = 0; i < gridColumns.length; i++) { if (gridColumns[i].dataIndex == dataIndex) { return i; } } }