Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Frank on Jan 21, 2009 18:28
open dhtmlx forum
How to change the color of part of the column name in grid

Although this requirement is weird , I really need to , please help me, thanks.

for instance: a column name is 'Test ABC' , I want the word 'test' to be black and 'ABC' to be red. I other Grids, I uddfsed html like
Test <font color=red>ABC</font> as the column name, but now we want to use Dhtmlx Grid, and I use xml to load the grid, but it said wrong xml. Is there any better way to do it? I'll appreciate your help.

here's my xml
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<rows>
    <head>
        <beforeInit>
            <call command=\"setSkin\">
                <param>light</param>
            </call>
        </beforeInit>
        <column width=\"100\" type=\"ro\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"Name\" >Name</column>
        <column width=\"60\" type=\"ro\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"Mark\" >Mark</column>
        <column width=\"60\" type=\"ro\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"Grade\" >Grade</column>
        <column width=\"120\" type=\"ed\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"13258\" >A7 <font color=red>(100)</font></column>
        <column width=\"120\" type=\"ed\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"13252\" >A2 <font color=red>(100.)</font></column>
        <column width=\"120\" type=\"ed\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"13253\" >A3 <font color=red>(100+4)</font></column>
        <column width=\"120\" type=\"ed\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"13256\" >A555 <font color=red>(100+5.)</font></column>
        <column width=\"120\" type=\"ed\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"13261\" >A10 <font color=red>(100+6)</font></column>
        <column width=\"120\" type=\"ed\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"13268\" >A13 <font color=red>(100.)</font></column>

        <settings>
            <colwidth>px</colwidth>
        </settings>
    </head>
</rows>
Answer posted by dhxSupport on Jan 22, 2009 05:07
You can use any html stored inside CDATA at the xml structure:
  <column width=\"120\" type=\"ed\" align=\"left\" color=\"#ffffff\" sort=\"str\" id =\"13252\" ><![CDATA[     A2 <font color=red>(100.)</font> ]]></column>