DHTMLX Docs & Samples Explorer

Events

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>
 
 
<table>
    <tr>
        <td>
            <div id="gridbox" style="width:600px;height:270px;overflow:hidden"></div>
        </td>
        <td>
            <div id="zoneA" style="width:400px;height:270px;overflow:auto;border:1px solid #000000;font-family:Tahoma; font-size:8pt;"></div>
        </td>
    </tr>
<table>
            
<script>
function log(message, args) {
    var div = document.createElement("div");
    for (var i = 0; i < 3; i++) {
        message += "<li>" + args[i];
    };
    message += "<br/>";
    div.innerHTML = message;
    document.getElementById('zoneA').appendChild(div);
}
//init grid and set its parameters (this part as always);
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../codebase/imgs/");
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;
//============================================================================================;
myDataProcessor = new dataProcessor("php/update.php");
//lock feed url;
myDataProcessor.init(mygrid);
//link dataprocessor to the grid;
 
myDataProcessor.attachEvent("onAfterUpdate", function() {
    log("onAfterUpdate", arguments);
    return true;
});
myDataProcessor.attachEvent("onRowMark", function() {
    log("onRowMark", arguments);
    return true;
});
myDataProcessor.attachEvent("onBeforeUpdate", function() {
    log("onBeforeUpdate", arguments);
    return true;
});
myDataProcessor.attachEvent("onValidatationError", function() {
    log("onValidatationError", arguments);
    return true;
});
myDataProcessor.attachEvent("onAfterUpdateFinish", function() {
    log("onAfterUpdateFinish", arguments);
    return true;
});
myDataProcessor.attachEvent("onFullSync", function() {
    log("onFullSync", arguments);
    return true;
})
//============================================================================================;
</script>