Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jeffsal on Jun 10, 2009 14:32
open dhtmlx forum
No Data in Grid

I get a table with the headers but no data is populated from the xml file and no errors:

<html>
<title>dhtmlxGrid Sample Page</title>

<link rel="STYLESHEET" type="text/css" href="dhtmlxgrid.css">
<script src="dhtmlxcommon.js"></script>
<script src="dhtmlxgrid.js"></script>
<script src="dhtmlxgridcell.js"></script>

<script>
var mygrid;
function doInitGrid(){
mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.setImagePath("/imgs/");
mygrid.setHeader("1,2,3,4,5,6");
mygrid.setInitWidths("*,150,150,*,*,*");
mygrid.setColAlign("left,right,right,right,right,right")
mygrid.setSkin("light");
mygrid.setColSorting("str,int,int,int,int,int");
mygrid.setColTypes("ed,ed,price,ed,ed,ed");
mygrid.attachEvent("onRowSelect",doOnRowSelected);
mygrid.init();
mygrid.loadXML("Varsity3.xml");
}

function addRow(){
var newId = (new Date()).valueOf()
mygrid.addRow(newId,"",mygrid.getRowsNum())
mygrid.selectRow(mygrid.getRowIndex(newId),false,false,true);
}
function removeRow(){
var selId = mygrid.getSelectedId()
mygrid.deleteRow(selId);
}

function doOnRowSelected(rowID,celInd){
alert("Selected row ID is "+rowID+"\nUser clicked cell with index "+celInd);
}

</script>

<body onload="doInitGrid()">

<div id="mygrid_container" style="width:600px;height:150px;"></div>
</body>
</html>
Answer posted by dhxSupport on Jun 11, 2009 01:23
Please check if Varsity3.xml file contain any data. 
Answer posted by jeffsal on Jun 11, 2009 05:53

Here is a portion of the xml file which was exported from an access database:

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2009-06-11T07:48:05">
<Varsity3>
<Field1>2009-05-26T00:00:00</Field1>
<Field2>Varsity</Field2>
<Field3>Green Bay Southwest</Field3>
<Field4>12:00 p.m.</Field4>
<Field5>Green Bay</Field5>
<Field6>5/26/2009</Field6>
</Varsity3>
<Varsity3>
<Field1>2009-06-15T00:00:00</Field1>
<Field2>Varsity</Field2>
<Field3>Green Bay Blue Jays</Field3>
<Field4>8:00 p.m.</Field4>
<Field5>Manitowoc</Field5>
<Field6>6/15/2009</Field6>
</Varsity3>
<Varsity3>
<Field1>2009-06-16T00:00:00</Field1>
<Field2>Varsity</Field2>
<Field3>DePere</Field3>
<Field4>5:30 p.m.</Field4>
<Field5>DePere</Field5>
<Field6>6/16/2009</Field6>
</Varsity3>
<Varsity3>
<Field1>2009-06-17T00:00:00</Field1>
<Field2>Varsity</Field2>
<Field3>Ash-Port</Field3>
<Field4>8:00 p.m.</Field4>
<Field5>Ashwaubenon</Field5>
<Field6>6/17/2009</Field6>
</Varsity3>

Answer posted by dhxSupport on Jun 11, 2009 07:35