Search code examples
dhtmlx

DHTMLX: how to put formatting into <afterInit> section in order to have the same result in all browsers?


enter image description here

If I have the following my.xml file:

<rowset>

  <head>
    <column width="60" hidden="false" type="ro">Col A</column>
    <column width="60" hidden="true" type="ro">Col B</column>
    <column width="60" hidden="false" type="ro">Col C</column>
    <column width="60" hidden="false" type="ro">Col D</column>

    <afterInit>
      <call command="attachHeader">
        <param>A,B,C,D</param>
        <param>color:green;,color:red;,color:blue;,color:yellow;</param>
      </call>
    </afterInit>

  </head>

  <row id="1">
    <cell>value1</cell>
    <cell>value2</cell>
    <cell>value3</cell>
    <cell>value4</cell>
  </row>
  <row id="2">
    <cell>value5</cell>
    <cell>value6</cell>
    <cell>value7</cell>
    <cell>value8</cell>
  </row>
  <row id="3">
    <cell>value-11</cell>
    <cell>value-12</cell>
    <cell>value-13</cell>
    <cell>value-14</cell>
  </row>

</rowset>

and the following .html file

<body>
    <div id="myGridContainer" width="799px" height="799px"></div>
</body>
<script>
    myGrid = new dhtmlXGridObject('myGridContainer');
    myGrid.setSkin("xp");
    myGrid.xml.top="rowset";
    myGrid.attachHeader("A,B,C,D",["color:green","color:red;","color:blue;","color:yellow;"]);
    myGrid.load("my.xml");
</script>

then I will receive bad output in Firefox and Chrome. IE works fine. I will create the .xml manually, so I will not use .attachHeader(). But how to create the <afterInit> section with color definitions to have the same result?


Solution

  • Instead of <afterInit> should be used <beforeInit>