PDA

View Full Version : Grid: incorrect values in my onClick function?



hallikpapa
6 Aug 2009, 1:13 PM
This should be a very basic question I think, but can't see the problem right now. I have even had this working in the past before, but doesn't work like this?

When I click on a row (onClick function), I am trying to populate a form with some data, but I noticed rowIndex is populated with a bunch of div tag info, and not the actual index of the row I clicked, so when I try and get the row/ id to query the DB, it's undefined. What did I miss?

Thanks


AdPortalAdmin.UserGrid = Ext.extend(Ext.ux.grid.livegrid.GridPanel, {
initComponent:function() {
var config = {
enableDragDrop : false,
cm : colModel,
title : 'Users',
height : 400,
width : 600,
plugins : [filters],
store : dataStore,
selModel : new Ext.ux.grid.livegrid.RowSelectionModel(),
view : userView,
bbar : bottomBar,
loadMask : {
msg : 'Loading...'
}
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
AdPortalAdmin.UserGrid.superclass.initComponent.apply(this, arguments);
},
onRender:function() {
dataStore.load();
AdPortalAdmin.UserGrid.superclass.onRender.apply(this, arguments);
},
onClick:function(grid,rowIndex,e){
console.log(rowIndex);
AdPortalAdmin.UserGrid.superclass.onClick.apply(this, arguments);
}

Animal
6 Aug 2009, 1:18 PM
That's not how it's done.

Add a listener for the rowclick event.

onXXXX are template methods and should only be used by advanced developers who understand the internal structure, lifecycle and workflow of the class.

hallikpapa
6 Aug 2009, 1:38 PM
Ah, gotcha. Thanks!