Our next step is to create a grid on the page. Actually, it requires a little effort.
To create a grid, we'll need:
"index.html" file
<html>
<head>
<title>Basic Grid</title>
<link rel="stylesheet" href="codebase/dhtmlxgrid.css">
<script src="codebase/dhtmlxgrid.js"></script>
</head>
<body>
<div id="mygrid_container" style="width:600px;height:250px;"></div> </body>
</html>
"index.html" file
<html>
<head>
<title>Basic Grid</title>
<link rel="STYLESHEET" type="text/css" href="codebase/dhtmlxgrid.css">
<script src="codebase/dhtmlxgrid.js"></script>
</head>
<body>
<div id="mygrid_container" style="width:600px;height:250px;"></div> <script type="text/javascript"> dhtmlxEvent(window,"load",function(){ mygrid = new dhtmlXGridObject("mygrid_container"); });
</script>
</body>
</html>
The constructor takes 1 parameter: an HTML container where the grid will be reside.
"index.html" file
dhtmlxEvent(window,"load",function(){
mygrid = new dhtmlXGridObject("mygrid_container");
mygrid.setImagesPath("codebase/imgs/"); //make sure you use ”/” at the end. });
"index.html" file
dhtmlxEvent(window,"load",function(){
mygrid = new dhtmlXGridObject("mygrid_container");
mygrid.setImagesPath("codebase/imgs/");
mygrid.setHeader("Name,Quantity,Price"); });
"index.html" file
dhtmlxEvent(window,"load",function(){
mygrid = new dhtmlXGridObject("mygrid_container");
mygrid.setImagesPath("codebase/imgs/");
mygrid.setHeader("Name,Quantity,Price");
mygrid.setInitWidths("*,150,150"); //col with '*' fills the remaining space});
"index.html" file
dhtmlxEvent(window,"load",function(){
mygrid = new dhtmlXGridObject("mygrid_container");
mygrid.setImagesPath("codebase/imgs/");
mygrid.setHeader("Name,Quantity,Price");
mygrid.setInitWidths("*,150,150");
mygrid.setColAlign("left,right,right");//use right align for numeric values});
"index.html" file
dhtmlxEvent(window,"load",function(){
mygrid = new dhtmlXGridObject("mygrid_container");
mygrid.setImagesPath("codebase/imgs/");
mygrid.setHeader("Name,Quantity,Price");
mygrid.setInitWidths("*,150,150");
mygrid.setColAlign("left,right,right");
mygrid.setSkin("light"); //applies the 'light' skin});
See a list of predefined skins here
"index.html" file
dhtmlxEvent(window,"load",function(){
mygrid = new dhtmlXGridObject("mygrid_container");
mygrid.setImagesPath("codebase/imgs/");
mygrid.setHeader("Name,Quantity,Price");
mygrid.setInitWidths("*,150,150");
mygrid.setColAlign("left,right,right");
mygrid.setSkin("light");
mygrid.init();});