Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by pyt on Sep 09, 2008 07:04
open dhtmlx forum
Background color

Hi,

I need to have background color for column headers as red instead of the default gray. I have tried code like this:

out.append("<column width=\"50\" type=\"ed\" align=\"right\"><![CDATA[<div style=\"background-color:red;width:100%;\">"+value+"</div>]]></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.

Thanks in advance!
Answer posted by Support on Sep 09, 2008 07:52
Its quite simple while setting columns from JS code ( third parameter of setHeader allows to define any custom styles )
In case of loading from XML ,there is no simple solution for such task, you can try to use something similar to next

in js code
  grid.setHeaderColor=function(a,b){  grid.hdr.rows[1].cells[a].style.backgroundColor=b; }

in XML 

<rows>
      <head>
          ...
          <afterInit><call command="setHeaderColor"><param>1</param><param>red</param></call></afterInit>
Answer posted on Sep 09, 2008 09:04
I have tried code like this:
out.append("<afterInit><call command=\"setHeaderColor\"><param>1</param><param>red</param></call></afterInit>");
but i obtain this error:
this[arr[i].getAttribute("command")] is undefined

and i need to change background color for part of column headers  Is it in case of loading from XML possible?
Answer posted by Support on Sep 09, 2008 10:17
>>but i obtain this error:
Did you add the js part of code provided above ?

Please check attached sample. 
Attachments (1)
Answer posted on Sep 10, 2008 04:22
It works!
Thank you.