Data not showing in a grid

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:
-------------
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../scripts/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css">

<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>
</head>
<body onload="doOnLoad()">
<div id="gridbox" style="width:600px; height:400px;"></div>
</body>
</html>

-------------
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' ?><rows><row id='8'><cell><![CDATA[8]]></cell><cell><![CDATA[Vallée de la Reine]]></cell></row>
<row id='22'><cell><![CDATA[22]]></cell><cell><![CDATA[Timberline Falls]]></cell></row>
<row id='11'><cell><![CDATA[11]]></cell><cell><![CDATA[Terres Sauvages de Brisban]]></cell></row>
<row id='19'><cell><![CDATA[19]]></cell><cell><![CDATA[Steppes de la Strie Flamboyante]]></cell></row>
...
<row id='32'><cell><![CDATA[32]]></cell><cell><![CDATA[Arche du Lion]]></cell></row>
</rows>
-------------
temp.log
-------------
====================================
Log started, 15/01/2013 12:01:32
====================================

SELECT `id`,`id`,`name` FROM maps ORDER BY `name` DESC

Done in 0.005748987197876s
Singman
 
Posts: 5
Joined: Tue Jan 15, 2013 11:00 am

Unfortunately the issue cannot be reconstructed locally.
Please, provide a demo link where the issue can be reconstructed.
sematik
 
Posts: 3375
Joined: Fri Mar 25, 2011 11:19 am

Instead, can you provide a REAL WORKING EXAMPLE with sources, including database ?
I think the Grid widget is have big problems with UTF-8 characters encoding.
Singman
 
Posts: 5
Joined: Tue Jan 15, 2013 11:00 am

Here you can find an example of grid with dataprocessor. Data is loaded if UTF-8:
http://www.dhtmlx.com/docs/products/dht ... _init.html

If your issue still occurs - please, provide a demo-link where the issue can be reconstructed.
sematik
 
Posts: 3375
Joined: Fri Mar 25, 2011 11:19 am

If I compare the given example and my source, there is a difference in the data returned in XML :
dhtmlx example :
<?xml version="1.0" encoding="utf-8"?>
<rows id="0">
<row id='79893'><cell><![CDATA[0]]></cell><cell><![CDATA[9999]]></cell><cell><![CDATA[6]]></cell><cell><![CDATA[10]]></cell><cell><![CDATA[1]]></cell><cell><![CDATA[na]]></cell><cell><![CDATA[0]]></cell><cell><![CDATA[11/30/-0001]]></cell></row>
...

My data :
<?xml version='1.0' encoding='utf-8' ?>
<rows>
<row id='8'><cell><![CDATA[8]]></cell><cell><![CDATA[Vallee de la Reine]]></cell></row>
...

Can you tell me why that happen ? I'm using the same connector, but maybe you have something in your php script ?
Singman
 
Posts: 5
Joined: Tue Jan 15, 2013 11:00 am

Just in case, the 2 differences are :
- using double quotes in your data
- returning <rows> with a parameter in your data
Singman
 
Posts: 5
Joined: Tue Jan 15, 2013 11:00 am

Ok, found the error :
- Missing dhtmlxgridcell.js file in header inclusion.

You can close this post.
Singman
 
Posts: 5
Joined: Tue Jan 15, 2013 11:00 am


Return to dhtmlxGrid/TreeGrid

Who is online

Users browsing this forum: No registered users and 120 guests