Required library edition:
Required library file: dhtmlxgrid.js
attach additional line to header
//plain usage grid.attachHeader("A,B,C,D"); //alternative syntax grid.attachHeader(["A","B","C","D"]) //colspans in header grid.attachHeader("A,#cspan,C,#cspan"); //rowspans in header grid.attachHeader("A,#rspan,C,#rspan"); //styles assigned grid.attachHeader("A,B,C,D",["","color:red;","",""]);
attachHeader() command supports HTML as values, so it may contain any HTML compatible content.
grid.attachHeader("A,<strong>B</strong>,C,<a href='http://dhtmlx.com'>D</a>");
If you need call attachHeader() command after grid was loaded you should call setSizes() command:
mygrid.load("grid.xml",function(){ mygrid.attachHeader("A,B,C,D"); mygrid.setSizes(); });
Attaching header from XML:
<head> <beforeInit> <call command="attachHeader"><param>A1,B1,C1</param></call> <call command="attachHeader"><param>A2,B2,C2</param> <param>text-align:right;,text-align:left;,text-align:center</param> </call> </beforeInit> </head>
See also: attachFooter, detachHeader, enableHeaderImages, setHeader, setNoHeader, setColumnLabel
Related articles: