Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by richard white on Feb 21, 2009 08:24
open dhtmlx forum
set style of grid headers

Hi,

we are loading a grid through xml and are trying to change the colours of individual headers in the grid... and make some column headers bold, some normal, some italic etc...

we are trying to set the style of the columns in xml but the changes are not showing in the grid when it is loaded

is there anyway to do this please

thanks
Answer posted by dhxSupport on Feb 23, 2009 02:25
 You can set header's styles through 3rd parameter of setHeader command

grid.setHeader("a,b,c",null,["text-color:red;","text-color:green;","text-color:blue;"])

Answer posted on Feb 23, 2009 04:23
hi

thanks for your reply, except i explained we were doing it in xml. i have tried applying styles to the headers in xml but it is not working

thanks
Answer posted on Feb 23, 2009 04:24
the solution your provided above is if we were setting column style in javascript but we are trying to set them in xml, and it is not working correctly - the styles are not showing
Answer posted by Support on Feb 23, 2009 06:16
When data loaded from XML , you can't specify styles for columns directly, but you can use inline HTML for the same

  <column width="50" type="dyn" align="right" color="white" sort="str"><![CDATA[<span style="font-weight:bold;"> Sales </span>]]></column>


Answer posted on Feb 28, 2009 11:34
hi

i dont want to change the text color of all items in a column - i just want to set the text colour of the columns header. i have tried it as you suggest using the cspan but we build up our xml docs in coldfusion and to do this we run the tostring function with converts the < symbols to &alt; etc... therefore it is not working

can you suggest how to set just the column header text colurs please

thanks
Answer posted by Support on Mar 03, 2009 06:57
The snippet above changes the color of header cell, so basically it is execute required task
Unfortunately, while init structure from XML , the usage of inline tags in header is the only way to define custom styles in header.
If you output already  xml-safe data you can use 

  <column width="50" type="dyn" align="right" color="white" sort="str">#tostring("<span style='font-weight:bold;'> Sales </span>")#</column>