Verificator

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?

Hmm, I just found:
viewtopic.php?f=2&t=15663&hilit=verificator

which may be what I need. I’d suggest putting a link to the above example in the verificator documentation on this page:
docs.dhtmlx.com/doku.php?id=dhtm … validation

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.

grid.attachEvent("onXLE", function(){ ...some code... });

will run code after data loading in grid

Thank you, I’ll give that a try. I can place the myDataProcessor.setVerificator() inside of this?

Yep
You can place there any code which need to run after data loading and initial grid rendering.

Thanks, everything is working correctly now.