DHTMLX Docs & Samples Explorer

Loading from JS array

You can load grid data from JS array.


Reload from JS array object
Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<script  src="../common/data.js"></script>
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxgrid.js"></script>        
<script  src="../../codebase/dhtmlxgridcell.js"></script>    
 
 
 
<div id="gridbox" style="width:500px; height:270px; background-color:white;"></div>
<br>    
<a href="javascript:void(0)" onclick='mygrid.clearAll(); alert("old data cleared\nloading new one..."); mygrid.parse(data,"jsarray");'>Reload from JS array object</a>
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../codebase/imgs/");
mygrid.setHeader("Sales, Book Title, Author");
mygrid.setInitWidths("70,250,*");
mygrid.setColAlign("right,left,left");
mygrid.setColTypes("dyn,ed,ed");
mygrid.setColSorting("int,str,str");
mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.load("../common/_data.js", "jsarray");
</script>