DHTMLX:如何将格式放入 <afterInit> 部分以便在所有浏览器中获得相同的结果?

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

如果我有以下 my.xml 文件:

<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>

和以下 .html 文件

<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>

然后我将在 Firefox 和 Chrome 中收到错误的输出。 IE 工作正常。我将手动创建 .xml,因此不会使用 .attachHeader()。但是如何创建具有颜色定义的 <afterInit> 部分以获得相同的结果?

您提供的代码应该可以正常工作。如果问题仍然存在,请提供演示 link 或完整的演示,问题可以在其中重构。

而不是<afterInit>应该使用<beforeInit>