Data validation can be done in few different ways
Grid provides two events, which can be used for validation purposes - onCellChanged and onEditCell
grid.attachEvent("onCellChanged",function(id,index,value){ if (index == SOME && !some_check(value)) grid.cells(id,index).setCValue("invalid"); })
or
grid.attachEvent("onEditCell",function(stage,id,index,new_value,old_value){ if (stage == 2 && index == SOME && !some_check(new_value)) return false; //deny edit operation })
Starting from dhtmlxGrid 2.2 there is a standalone validation extension. It uses the same approach as described above solution, but hides all details about which events and how need to be used, providing abstract validation interface.
To use extension you need to include next js file
<script src="codebase/ext/dhtmlgrid_validation.js">
Validation rules created through extension can work in two modes:
Rules can be defined per column, or fore some specific cells only.
Extension provides - predefined validation rules and ability to create custom rules.
In addition to default usage scenario it possible to force data checking at any time by script command, integrate them with dataprocessor or use additional events to customize them even more.
Dataprocessor has its own way to attach validation. Its validation check will run exactly before data sending to the server and block data sending if data was invalid.