Based on the example, I’ve made grid connected to a MySQL database via the connector.
My problem is that my grid is just empty, but i have no errors at run time.
grid.html:
<script src="../scripts/dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<script src="../scripts/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script src="../scripts/dhtmlx/dhtmlxConnector/codebase/connector.js"></script>
<script src="../scripts/dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
<script type="text/javascript">
var mygrid, myDP;
function doOnLoad() {
mygrid = new dhtmlXGridObject("gridbox");
mygrid.setImagePath("../scripts/dhtmlx/dhtmlxGrid/codebase/imgs/");
mygrid.setHeader("Id,Nom");
mygrid.setInitWidths("80,*");
mygrid.init();
mygrid.load("grid.php");
myDP = new dataProcessor("grid.php");
myDP.init(mygrid);
}
</script>
grid.php :
<?php require_once('../scripts/dhtmlx/dhtmlxConnector/codebase/grid_connector.php'); $res = mysql_connect("localhost","root",""); mysql_select_db("singman"); mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'"); $conn = new GridConnector($res, "MySQL"); $conn->enable_log("temp.log"); $conn->render_table("maps","id","id, name"); ?>Result of grid.php :
<?xml version='1.0' encoding='utf-8' ?>
…
temp.log
====================================
Log started, 15/01/2013 12:01:32
SELECT id
,id
,name
FROM maps ORDER BY name
DESC
Done in 0.005748987197876s