PDA

View Full Version : problems with cellclick and deletefunction



taberg
30 Jul 2007, 3:49 AM
Hi,

I have a editorgrid with one column acting as garbage bin ie. when user clicks the cell the row is deleted.

To catch when user clicks the cell i use 'cellclick' event like this:



//Handle cellclicks in the grid
grid.on('cellclick', function(grid, rowIndex, columnIndex, e) {
//Clicked the removecolumn.
if (grid.colModel.getColumnId(columnIndex) == 'colRemove') {
remRow();
}
});


It works very well until you doubleclick the cell, then you get following errormsg in firebug:
Index or size is negative or greater than the allowed amount" code: "1 Line 0

my remove function looks like this:



function taBortRad() {
var cell = grid.getSelectionModel().getSelectedCell();
var r = ds.getAt(cell[0]);
var IndvKmptId = r.get('IndvKmptId');
var KmptId = r.get('KmptId');
var KravKomp = r.get('KmptNivIdKrav');
if (IndvKmptId && KmptId && !KravKomp) {
gridForm.submit({
url: url,
params:{_pr:'Kmpt_Del', IndvKmptId: IndvKmptId},
method: 'post',
success:function(form, action) {
var rec = new Ext.data.Record({KmptId: r.data.KmptId ,KmptTxt: r.data.KmptTxt });
dsKomp.add(rec);
dsKomp.add(r);
ds.remove(r);
UIinfo.msgTop(L('Info'), L('Competence removed successfully'));
},
failure: function(form, action) {
UIinfo.msgTop(L('Info'), L('Error while deleting...'));
}
});
}
}


where the three fields IndvKmptId && KmptId && !KravKomp are required.
How do i take care of the dlbclick event? since it seems like it want to trigger something after the row is removed...

/T

tryanDLS
30 Jul 2007, 8:54 AM
Use the ext-all-debug.js file to see what's actually being executed. You probably don't want to allow the code to allow the doubleclick to process. Try setting e.cancel = true or returning false from your click handler.