PDA

View Full Version : Getting Data Record after Cell Dbl Click



visualinventor
19 Oct 2007, 7:23 AM
this.grid.on('celldblclick', function(ob,rIndex,cIndex,e){
var gcm = iUpdate.DisplayGrid.grid.getColumnModel().getColumnHeader(cIndex);
var params = iUpdate.DisplayGrid.grid.getDataSource().getAt(rIndex);
var id = iUpdate.DisplayGrid.grid.getGridEl();
if(gcm == 'Content'){
if(!viewer){
viewer = new iUpdate.Viewer(false, params, id);
}
}
});


This is the code that I am using to register a double click event for a grid cell. I am trying to pass the data record into the 'iUpdate.Viewer()' constructor which then opens a dialog. I am using 'iUpdate.DisplayGrid.grid.getDataSource().getAt(rIndex);' to get the record, but when I check the post data in firebug I get:
dirty : false
editing: false
id : 145

Am I using the wrong method to get the record?

Wolfgang
3 Nov 2007, 1:37 PM
Maybe this helps:


mygrid.on('celldblclick', function(grid, rowIndex, colIndex) {
var rowRecord = grid.getSelectionModel().getSelected();
if (typeof rowRecord != 'object') {
return false;
}
// rowRecord contains the data of your selected row
// get some data
// var oldValue = rowRecord.get('yourfieldname');
// modify some data. this updates also the store and sets the diry flag
// var newvalue = 'abc';
// rowRecord.set('yourfieldname', newvalue);
}, myScopeIfNeeded);


Regards

Wolfgang