Categories | Question details Back To List | ||
Validate Grid's cell value. Thanks for your quick response. I have a doubt on the below code which you provided for my last query. mygrid.attachEvent("onEditCell",function(stage,rowId,cellId,newValue,oldValue){ Query is, the above function will be accessed by all cells that have editable option. But I would like to restrict to a particulat cell say, price field. Could you please let me know, how to do it. ALso, how to set the modified.formatted value back in to the cell itself.
Thanks, Vijay Answer posted by dhxSupport on Mar 11, 2009 04:29 When "onEdintCell" event fired it contain information about row id, cell index, old cell's value, new cell's value, stage - stage of editting (0-before start[can be canceled if returns false],1-editor opened,2-editor closed). mygrid.attachEvent("onEditCell",function(stage,rowId,cellId,newValue,oldValue){ if ((stage==2)&&(cellInd==0)){ //here you are checking, if editor is closed AND event has fired on the first column //validate newValue return true; } return true; }); If you would like to restrict to a particular cell you can use following condition: if ((stage==2)&&(cellInd==0)&&(rowId==necessarRowId)) >>ALso, how to set the modified.formatted value back in to the cell itself. To set modified formatted value back in to the cell you can use setValue("newValue") method: if ((stage==2)&&(cellInd==0)){ mygrid.cellById(rowId,cellInd).setValue(0.0); return true; } |