Hi,
I did something what writes data to a txt file. Now I want to display the data in the table dhtmlx. I do not know how to do this so please help.
<span class="syntaxdefault"><?php
if(isset($_POST['login']))
{
$d = date('Y-m-d H:i:s')."Log on:\r\n";
$file = "log.txt";
$fp = fopen($file, "a");
flock($fp, 2);
fwrite($fp, $d);
flock($fp, 3);
fclose($fp);
}
else{
echo "empty" ;
}
?>
</span>
cm1310
October 11, 2011, 11:41am
#2
Open the file, read line by line and send lines to the Browser.
Yes, but I’m interested in how to do display data from txt file in the table dhtmlx. I know how to do it pulling from the database mysql, but I do not know how to txt file. I ask for some tutorial or how to do it. Thank you
cm1310
October 12, 2011, 10:48am
#4
Ok, step by step.
The request must come from the browser to your server. If it you open your file in PHP, read it and convert the read datas in XML, CSV or JSON format. After this send the datas to your browser.
How to init the grid, load and display the datas you can find a lot of examples here:
dhtmlx.com/docs/products/dhtmlxGrid/samples/
docs.dhtmlx.com/doku.php?id=dhtm … earandload
Ok I’ve done by help. But my data does not load the xml file.
<div id="gridbox" style="width:503px;height:120px;background-color:white;"></div>
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../codebase/imgs/");
mygrid.setHeader("Name,Date of Birth, First Book Published");
mygrid.setInitWidths("*,100,100");
mygrid.setColAlign("left,center,center");
mygrid.setColTypes("ed,dhxCalendar,dhxCalendarA");
mygrid.setColSorting("str,date,date");
mygrid.setSkin("dhx_skyblue");
mygrid.init();
mygrid.loadXML("../common/xml/gridData.xml");
</script>
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<row id="1">
<cell>John Grisham</cell>
<cell>05/01/1998</cell>
<cell>05/01/1998</cell>
</row>
<row id="2">
<cell>Stephen King</cell>
<cell>01/01/2000</cell>
<cell>05/01/1998</cell>
</row>
<row id="3" selected="1">
<cell>John Grisham</cell>
<cell>12/01/2001</cell>
<cell>05/01/1998</cell>
</row>
</rows>
My errors:
Description: Incorrect cell type: dhxCalendar
Description: Incorrect cell type: dhxCalendarA
Error type: LoadXML
Description: Incorrect XML
Olga
October 12, 2011, 12:46pm
#6
cm1310
October 12, 2011, 1:22pm
#7
Did you include all needed DHTMLX javascript files (in correct order)?
I checked and everything just as it is written there.But all time this same errors
Error type: LoadXML
Description: Incorrect XML
<link rel="stylesheet" type="text/css" href="dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxgrid.css" />
<link rel="stylesheet" type="text/css" href="dhtmlxGrid/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css" />
<script src="dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxcommon.js" type="text/javascript"></script>
<script src="dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxgrid.js" type="text/javascript"></script>
<script src="dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxgridcell.js" type="text/javascript"></script>
<script src="dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxcontainer.js" type="text/javascript"></script>
sematik
November 10, 2011, 6:09pm
#9
Unfortunately the issue cannot be reconstructed locally.
Please provide a complete demo or demo link where the issue can be reconstructed