The html is exactly as the sample page:
<!DOCTYPE html>
<!--pro-->
<html>
<head>
<title>Configuration from JSON - DHTMLX Json</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
<script src="../../../codebase/dhtmlx.js"></script>
<script>
var myGrid;
function doOnLoad(){
myGrid = new dhtmlXGridObject('gridbox');
myGrid.setImagePath("../../../codebase/imgs/");
myGrid.enableAutoWidth(true);
myGrid.load("../common/gridConfig.json", "json");
}
function ser(){
myGrid.setSerializationLevel(false,false,true);
document.getElementById("alfa1").innerHTML=myGrid.serialize().replace(/\</g,"<").replace(/\>/g,">").replace(/\<row/g,"<br/><row");
}
</script>
</head>
<body onload="doOnLoad()">
<h1>Configuration from JSON - DHTMLX Json</h1>
<p>Configuration of grid can be loaded from JSON file. You need only 2-3 script commands to get the grid up and running.</p>
<div id="gridbox" style="width:600px; height:300px; background-color:white;"></div>
<a href='#alfa' onClick="if(myGrid.setSerializationLevel){ser();} else {alert('Available in Pro Edition only')}">Serialize grid</a>
<a name="alfa">
<div id="alfa1"></div>
</a>
</body>
</html>
I create the file in the \samples\dhtmlxGrid\12_initialization_loading folder, so, should be no problem, the gridConfig.json file is in \samples\dhtmlxGrid\common, and the content is:
{
head:[
{ width:70, type:"dyn", align:"right", sort:"int", value:"Sales" },
{ width:150, type:"ed", align:"left", sort:"str", value:"Book Title" },
{ width:100, type:"ed", align:"left", sort:"str", value:"Author" },
{ width:80, type:"price", align:"right", sort:"str", value:"Price" },
{ width:80, type:"ch", align:"center", sort:"str", value:"In Store" },
{ width:80, type:"co", align:"left", sort:"str", value:"Shipping",
options:[
{ id:1, value:"Fast"},
{ id:2, value:"Slow"}
]}
],
rows:[
{ id:1001,
data:[
"100",
"A Time to Kill",
"John Grisham",
"12.99",
"1",
"1"] },
{ id:1002,
data:[
"1000",
"Blood and Smoke",
"Stephen King",
"0",
"1",
"1"] },
{ id:1003,
data:[
"-200",
"The Rainmaker",
"John Grisham",
"7.99",
"0",
"2"] }
]
}
With the dhtmlx.js of the sample page works perfectly (as i said before), but, with the dhtmlx.js file of the standard suite doesn’t:
/*
Product Name: dhtmlxSuite
Version: 5.0
Edition: Standard
License: content of this file is covered by GPL. Usage outside GPL terms is prohibited. To obtain Commercial or Enterprise license contact sales@dhtmlx.com
Copyright UAB Dinamenta http://www.dhtmlx.com
*/
With the dhtmlxgrid.js 5.0 standard file i get the same firebug error:
TypeError: this.obj.firstChild is null
..._isKHTML){this.obj.appendChild(c)}else{this.obj.firstChild.appendChild(c)}}else{...
dhtmlxgrid.js (línea 9, columna 385226)
error points to …}else{this.obj…
With dhtmlx.js suit, the firebug error is:
TypeError: this.obj.firstChild is null
..._isKHTML){this.obj.appendChild(e)}else{this.obj.firstChild.appendChild(e)}}else{...
dhtmlx_.js (línea 9, columna 833370)
error points to …}else{this.obj…