DHTMLX Docs & Samples Explorer

Multirow header

You are allowed to set multirow header in two ways:

Using script

Extend Header

Using XML (Professional Edition)

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="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxgrid.js"></script>        
<script  src="../../codebase/dhtmlxgridcell.js"></script>    
 
 
 
<h3>Using script</h3>
<div id="gridbox" style="width:600px; height:200px; background-color:white;"></div>
<div>
    <a href="javascript:void(0)" onclick='mygrid.attachHeader(["#rspan","Title","Author","#rspan","#rspan","#rspan","Bestseller","Published"]);mygrid.setSizes();'>Extend Header</a>
</div>
<h3>Using XML (Professional Edition)</h3>
<div id="gridbox2" style="width:600px; height:200px; background-color:white;"></div>
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../codebase/imgs/");
mygrid.setHeader("Sales,Book,#cspan,Price,In Store,Shipping,Other Info,#cspan");
mygrid.setInitWidths("50,150,150,80,80,80,80,200");
mygrid.setColAlign("right,left,left,right,center,left,center,center");
mygrid.setColTypes("dyn,ed,ed,price,ch,co,ra,ro");
mygrid.getCombo(5).put(2, 2);
mygrid.setColSorting("int,str,str,int,str,str,str,str");
mygrid.setColumnColor("white,#d5f1ff,#d5f1ff");
mygrid.setColumnMinWidth(50, 0);
mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.enableMultiselect(true);
mygrid.loadXML("../common/grid.xml");
</script>