I am wanting to use dp.setVerificator(index,method) to valid some data before sending to database. I would like the dataprocessor to stop and change a grid cell with a different color background when the checked value does not pass verification. And to continue and reset grid cell background when the checked value does pass verification.
The documentation for dp.setVerificator() states that “The function, based on such values, must return true (to accept value) or false (to deny value). If any value was denied during validation, data sending will be blocked and onValidatationError event generated”.
I am not able to use the mygrid.attachEvent(“onValidationError”… or mygrid.attachEvent(“onValidationCorrect”… to change the grid cell background; however, the dataprocessor is accepting or denying the value as expected.
Is there a sample where the dataProcessor triggers the onValidationError event?
I do have another question about the validator now. I am using it on a grid as the examples above show with hard coded column numbers. However, I have an unknown amount of columns coming in, so would like to do something like this to validate the 3rd to the last column:
var totalCols = mygrid.getColumnsNum();
var cstCol = totalCols - 2;
myDataProcessor.setVerificator(cstCol, less_1);
I keep getting undefined for mygrid.getColumnsNum(). How do I make sure this fires after the grid loads? I tried using the onBeforeUpdate event and that will return the correct grid data, but will not run the setVerifcator.