DHTMLX Docs & Samples Explorer

attachHeader(values, style)

Required library edition: This method works with any edition of DHTMLX library
Required library file: dhtmlxgrid.js

attach additional line to header

  • values - array of header titles
  • style - array of styles, optional
        //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();
});

See also: attachFooter, detachHeader, enableHeaderImages, setHeader, setNoHeader, setColumnLabel

Related articles: