PDA

View Full Version : How to get row data when click on grid cell with cellmodel



glafrance
19 Sep 2012, 6:01 PM
I have a treepanel with a templatecolumn with link text, and a click listener which is being called, and I see there are 9 possible args coming into the listener, but how can I access the row data?

The template column is the third column, but which of those 9 args should I use to get the data from the 1st or second column from the row data?

Its strange, I've seen so many examples on the web that refer to itemclick, select, etc., and that code never works for me, because I'm using the click event (those other events are not dispatched in this case).


xtype: 'templatecolumn',
flex: 1,
tpl: '<a href="#">switch</a>',
listeners: {
click: function(a, b, c, d, e, f, g, h, i){
...

glafrance
19 Sep 2012, 6:23 PM
xtype: 'templatecolumn',
flex: 1,
tpl: '<a href="#">switch</a>',
listeners: {
click: function(grid, cellElement, rowIndex, cellIndex){
debugger;
var gridstore = grid.getStore();
var rowdata = gridstore.data.items[rowIndex];
var name = rowdata.data['name'];
var id = rowdata.data['id'];