How to send an entire grid server side and store its elements in the database.
and I do not know how to receive grid at the server and store its elements in the database.
here is my complete script on the client side.
<html>
<head>
<title> Mission est </title>
<script type="text/javascript" src="vue/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="vue/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script type="text/javascript" src="vue/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script>
<script type="text/javascript" src="vue/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
<script type="text/javascript" src="vue/dhtmlxForm/codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="vue/dhtmlxForm/codebase/dhtmlxform.js"></script>
<script src="dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
<script type="text/javascript">
//formulaire
var formData,myform;
function doOnLoad()
{
formData=
[
{
type: "select",
name: "modetransport",
label: "Mode de transport",
labelWidth: 150,
inputWidth: 160,
options:
[
{
text: "Par Batteau",
value: "Par Batteau"
},
{
text: "Par bus",
value: "Par bus"
},
{
text: "Par Train",
value: "Par Train"
},
{
text: "Par Batteau",
value: "Par Batteau"
}
]
},
{
type: "select",
name: "depart",
label: "Ville de départ",
labelWidth: 150,
inputWidth: 160,
options:
[
{
text: "Bamenda",
value: "bamenda"
},
{
text: "Douala",
value: "Douala"
},
{
text: "Bafoussam",
value: "Bafoussam"
},
{
text: "Garoua",
value: "Garoua"
}
]
},
{
type: "select",
name: "arrivee",
label: "Ville de destination",
labelWidth: 150,
inputWidth: 160,
options:
[
{
text: "Bamenda",
value: "bamenda"
},
{
text: "Douala",
value: "Douala"
},
{
text: "Bafoussam",
value: "Bafoussam"
},
{
text: "Garoua",
value: "Garoua"
}
]
},
{
type: "input",
name: "cout",
label: "Cout",
labelWidth: 150,
inputWidth: 160,
},
{
type: "fieldset", name: "mydata", label: "Opérations", width:330,
list:
[
{
type: "button",
name:"ajouter",
value:"Ajouter"
},
{
type: "newcolumn"
},
{
type: "button",
name:"envoyer",
value:"Envoyer"
}
]
}
]
myform = new dhtmlXForm("box", formData);
//formualire
var grid = new dhtmlXGridObject('gridbox');
grid.setImagePath("vue/dhtmlxGrid/codebase/imgs/");
grid.setHeader("Mode de transport,Départ,Arrivée,Cout");
grid.setInitWidths("200%,200%,200%,200%");
grid.setColTypes("ed,ed,ed,ed");
grid.setColAlign("center,center,center,center");
grid.setColSorting("connector");
grid.setSkin("dhx_skyblue");
grid.init();
grid.attachEvent("onEditCell", function() {
return false;
});
/*grid.addRow(1, ["Avion", " Yaoundé","Douala","9000"]);
grid.addRow(2, ["Train", " Douala ","Bafoussam","80000"]);
grid.addRow(3, ["Transport en commum", " Bafoussam","Yaoundé","10000"]);*/
//alert(grid.cells(1,3).getValue());
//alert(grid.getAllRowIds(","));
//alert(grid.getRowsNum());
//grid.clearAll(true);
//grid.moveRowDown(1);
//grid.moveRowUp(3);
myform.attachEvent("onButtonClick", function(name)
{
if(name=="ajouter")
{
grid.addRow(-1, [myform.getItemValue('modetransport'),myform.getItemValue('depart'), myform.getItemValue('arrivee'),myform.getItemValue('cout')]);
}else
if(name=="envoyer")
{
alert("envoyer au serveur")
var dp = new dataProcessor("test.php");
dp.init(grid);
dp.setUpdateMode("off")
dp.sendData();
}
});
}
</script>
<link rel="stylesheet" type="text/css" href="vue/dhtmlxGrid/codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="vue/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<link rel="stylesheet" type="text/css" href="vue/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css"/>
</head>
<body onload="doOnLoad();">
<div id="box" style='width:800px; height:160px;float:left;'></div><br/>
<div id="gridbox" style='width:800px; height:200px;'></div>
</body>
</html>
here is my complete server-side script.
thank you for your help
chechbox_dhtmlx.rar (254 KB)