Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nancy on May 07, 2008 07:54
open dhtmlx forum
Background color

How to set column headers background color
Answer posted by Support on May 07, 2008 09:38
The global setting can be adjusted in dhtmlxgrid.css

    div.gridbox table.hdr td {
        ...
        background-Color:#D4D0C8;

Please beware that such value can be redefined by skin specific styles

If you need to set it directly from js code, it can be done as
    grid.setHeader("A,B,C",null,["background-color:red","background-color:blue","background-color:green"])
The third parameter is an array of styles, which will be assigned to header cells.
Answer posted by Nancy on May 07, 2008 23:13

Hi,

Thanks for the reply. It si working fine. But I need to set the background in <column> tag. My syntax is like this:

Response.Write "<column width=""100"" type=""ro"" align=""left"" color=""white"" sort=""na"">" & _
    "<![CDATA[<b>" & sData & "</b>]]></column>"

Here how can I set column headers background color. Please Suggest.

Answer posted by Support on May 08, 2008 05:37
You can place some html element with backdround in the the header cell. For example:

<column width="100" type="ro" align="left" color="white" sort="na"><![CDATA[<div style="background-color:red;....">COLUMN</div>]]></column>

Answer posted by Nancy on May 08, 2008 05:49

Hi,

Thanks for the reply. I have tried this syntax in several ways:

Response.Write "<column width=""100"" type=""ro"" align=""left"" color=""white"" rowspan="" " & RowSpan & " "" colspan="" " &ColSpan &" "">""<![CDATA[<div style=""background-color:red;"">" & sample & "]]></column>"

Response.Write "<column width=""100"" type=""ro"" align=""left"" color=""white"" rowspan="" " & RowSpan & " "" colspan="" " &ColSpan &" "">""<![CDATA[<div style=""background-color:red;width:100%"">" & sample & "]]></column>"

Column headers are displayed but only the values came with background color not the whole column header. Please suggest how to set background color for whole column header.