Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dave on Feb 19, 2009 09:32
open dhtmlx forum
dhtmlxGRID onEditCell don't update

Hi, i'm using the grid and the onEditCell function...
In the state 2 after update the cell the new value doesn't stored in the cell....

The new value is displayed when i edit but after lost focus the cell have the old value...

Can you help me....???


function doOnCellEdit(stage,sID,cellInd, newVal,oldVal)
{
if (stage==1)
{
     if (mygrid.cells(sID,5).getValue()=="1")
    {
mygrid.editStop();
alert("Campo non editabile");
}
return;
}

     if (stage==2)
     {
     if (mygrid.cells(sID,5).getValue()=="0")
    {
     if (mygrid.cells(sID,3).wasChanged()==true)
     {
     //mygrid.cells(sID,3).setValue(newVal);
     if (ArrChange.length==1 && ArrChange[0]==''){ArrChange[0]=sID;}
     else
     {
     var trov=false;
     for(i=0;i<ArrChange.length;i++)
{
     if (ArrChange[i]==sID){trov=true;}
     }
     if (trov==false){ArrChange[ArrChange.length]=sID}
    
     }
     mygrid.editStop();
    
     }
     }
     }
}



thanks a lot...
Dave


Answer posted by Support on Feb 19, 2009 09:50
Be sure that custom function assigned to onEditCell returns "true"
If onEditCell returns
   true - edit operation confirmed
   false or nothing - edit operation cancelled
   any string - value used instead of one entered by user

Just add in your code
...
     }
      return true;
}



Answer posted by Dave on Feb 19, 2009 23:51
Thanks a lot,
i failed to write the event name, i write "onEditCell"   instead of "onCellEdit" and the return failed...
Tanks very much for your fast answer....

Dave
Answer posted by Dave on Feb 20, 2009 00:02
Sorry, the name of events it's right "onEditCell"...i have to check the return code...