Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Janice on Mar 24, 2008 04:27
open dhtmlx forum
setVerificator for single cell in column. Possible?

Hello,

I'd like to use setVerificator for a single cell. Would that be possible? Also, can a function similar to checkIfNotZero be used to compare 2 grid values (instead of comparing the value to 0, I'd like to compare it to a that of different cell in the same column).

Thanks
Answer posted on Mar 24, 2008 06:08
Try to use setOnBeforeUpdateHandler method instead of setVerificator. "onBeforeUpdate" event handler gets the id  of  updated row as the first parameter, so you can place any logic here.
 
For example, the following code denies updating if the first cell in updated row is equal to the second one:
 
myDataProcessor.setOnBeforeUpdateHandler(onBeforeUpdateFunc);
 
function onBeforeUpdateFunc(rowId,status){
 
    if(mygrid.cells(rowId,0).getValue()==mygrid.cells(rowId,1).getValue()){
       
        return false
   
    }
   
    else return true
 
}