Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Euler Sánchez Gómez on Nov 03, 2009 16:03
open dhtmlx forum
get row value selected when edit

Hi, is there any way to get the value selected when edit, i mean, when i give double click on a cell, and this cell is going to be edited, i need that the actual value of the cell appears like selected by the mouse, i have the next code

function calculateFooterValues(stage,id,ind){
if (stage==0){
oldvalue=mygrid.cells(id,2).getValue();
}

if(stage==2){ //SOMETHIG HERE, WHEN STAGE==2

if (isNaN(mygrid.cells(id,2).getValue())){
alert ("Error");
mygrid.cells(id,2).setValue(oldvalue);
return true;
}
if ((mygrid.cells(id,2).getValue()%1)>0 || (mygrid.cells(id,2).getValue<1) || (mygrid.cells(id,2).getValue=='')){
alert ("Error");
mygrid.cells(id,2).setValue(oldvalue);
return true;
}
if (mygrid.cells(id,2).getValue()<1){
alert ("Error en la cantidad");
mygrid.cells(id,2).setValue(oldvalue);
return true;


thanks in advance for your reply
Answer posted by dhxSupport on Nov 05, 2009 09:15
You can use:

mygrid.attachEvent("onEditCell",function(stage,rowId,cellIndex){
if (stage==1){
var c=this.editor.obj;
c.select();
return true;
}
return true;
});

Answer posted by Euler Sanchez Gomez on Nov 05, 2009 10:05
Thanks in advance for your reply, now works fine.

Greetings.