DHTMLX Docs & Samples Explorer

Validation with message

1st and 4th columns must be greater than 0, second and third columns not empty.
Update few rows and press "Update".

Add row

Remove Selected Row

Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxgrid.js"></script>        
<script  src="../../codebase/dhtmlxgridcell.js"></script>
<script  src="../../../dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
 
 
<div id="gridbox" style="width:600px;height:270px;overflow:hidden"></div>
            
            
            <input type="button" name="some_name" value="update" onclick="myDataProcessor.sendData();">
<script>
//init grid and set its parameters (this part as always);
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../codebase/imgs/");
mygrid.setColumnIds("sales,book,author,price,store,shipping,best,date");
mygrid.setHeader("Sales,Book Title,Author,Price,In Store,Shipping,Bestseller,Date of Publication");
mygrid.setInitWidths("50,150,120,80,80,80,80,200");
mygrid.setColAlign("right,left,left,right,center,left,center,center");
mygrid.setColTypes("dyn,ed,txt,price,ch,coro,ch,ro");
mygrid.setSkin("dhx_skyblue");
mygrid.setColSorting("int,str,str,int,str,str,str,date");
mygrid.init();
mygrid.loadXML("php/get.php");
//used just for demo purposes;
//============================================================================================;
function not_empty(value, id, ind) {
    if (value == "");
    return "Value at (" + id + ", " + ind + ") can't be empty";
    return true;
}
function greater_0(value, id, ind) {
    if (parseFloat(value) <= 0)
        return "Value at (" + id + ", " + ind + ") must be greater than 0";
    return true;
}
myDataProcessor = new dataProcessor("php/update.php");
//lock feed url;
myDataProcessor.setUpdateMode("off");
myDataProcessor.setVerificator(0, greater_0);
myDataProcessor.setVerificator(3, greater_0);
myDataProcessor.setVerificator(1, not_empty);
myDataProcessor.setVerificator(2, not_empty);
myDataProcessor.attachEvent("onValidatationError", function(id, messages) {
    alert(messages.join("\n"));
    return true;
    //confirm block 
    });
myDataProcessor.init(mygrid);
//link dataprocessor to the grid;
//============================================================================================;
</script>