Je suis tout débutant en dhtmx, j’ai écrit un petit code en utilisant le composant
dhtmlxconnector, mais jusqu’a present je ne parviens pas à charger les données de mes tables dans une grille, pourtant j’ai respecté ce qui est dans la documentation.
Here is my client side code.
<html>
<head>
<title>
premier test langage pljava
</title>
<style>
.global
{
width:400px;
height:400px;
margin:auto;
}
</style>
<script src="codebase/dhtmlx.js" type="text/javascript"></script>
<script src="codebase/connector.js"></script>
<script src="codebase/dataprocessor.js"></script>
<link rel="STYLESHEET" type="text/css" href="codebase/dhtmlx.css">
<script type="text/javascript">
var mygrid,myDP;
function doOnLoad()
{
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("codebase/imgs/");
mygrid.setHeader("nom,prenom,email,telephone,ville,filliere,id_classe");
mygrid.attachHeader("#connector_text_filter,#connector_select_filter,#connector_select_filter");
mygrid.setInitWidths("200,80,*");
mygrid.setColTypes("ro,ed,ed");
mygrid.setColSorting("str,connector,str");
mygrid.init();
mygrid.load("traitement.php");
myDP = new dataProcessor("traitement.php");
myDP.init(mygrid);
}
</script>
</head>
<body onload="doOnLoad()">
<div id="gridbox" style="width:450px;height:250px;border:1px solid #A4BED4;"></div>
</body>
</html>
the server side code
<?php
try {
require_once("codebase/grid_connector.php");
$res=new PDO('pgsql:host=localhost port=5436 dbname=etudiant', 'postgres', 'fb12fb12b');
$gridConn=new GridConnector($res,"PDO");
if ($gridConn->is_select_mode())
{
$gridConn->render_sql("SELECT * FROM etudiant,classe WHERE etudiant.id_classe=classe.id_classe","etudiant.id_etudiant","nom,prenom,email,telephone");
}else
{
$gridConn->render_table("etudiant","id_etudiant","nom,prenom,email,telephone");
}
//$sql=$db->query("SELECT * FROM resultatresultset_test()");
//$result = $sql->fetchAll();
//var_dump($result);
}
catch (PDOException $e)
{
print "Erreur !: " . $e->getMessage() . "<br/>";
die();
}
?>
i have following error:
[15-Jan-2013 07:29:22] PHP Warning: PDO::__construct() expects parameter 1 to be string, object given in H:\Program Files\Zend\Apache2\htdocs\testpljava\codebase\base_connector.php on line 344
[15-Jan-2013 07:29:22] PHP Fatal error: Call to a member function select() on a non-object in H:\Program Files\Zend\Apache2\htdocs\testpljava\codebase\base_connector.php on line 513
quelqu’un peut il m’aider svp