Hello,
Regarding my previous question, your answer was:
-----------------------------------------------------------------------------------------
- I want to use something similiar to Dataprocessor’s “checkBeforeUpdate” function
var result = true;
grid.forEachRow(function(id){
if (!grid.validateCell(id, INDEX))
result=false;
});
-----------------------------------------------------------------------------------------
How do I make validateCell to call MY specific validation function?
First;
//Adds the custom validations
dhtmlxValidation.isCharge=function(a){
if (a != null && a != “”){
var aNumber = new Number(a);
if (isNaN(aNumber) || (aNumber < 0.1)){
return false;
}
}
return true;
};
Then:
myGrid.enableValidation(true);
or
myGrid.enableValidation(false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
Then
myGrid.setColValidators([null,null,null,“Charge”,null,null,null,null,null,null,null,null,null,null,null,null,null,null]);
And finally calling the function to validateData:
function validateData(){
var result = true;
for(var _i = 0; _i < myGrid.getColumnCount(); _i++){
myGrid.forEachRow(function(id){
if (!result && !myGrid.validateCell(id, _i)){
result = false;
}
});
if (!result){
break;
}
}
return result;
}
Thanks!
Andres