2012-01-04 69 views
1

我有一些数据属性,我把表放在一个表行标记。 当我将表格设置为wijgrid时,数据属性被销毁。Wijgrid破坏数据属性

如何避免wijmo破坏这些属性?

回答

1

当应用对行(tr)属性,他们只是通过插件忽略(如你有经验的),不管他们是(样式,类,数据...)。

它似乎是自愿的,因为通常会提取行的属性的代码片段在插件源中进行了注释。

在该方法中readTableSection,我们(我删除的代码在这里不相关的线):

readTableSection: function(table, section, readAttributes) { 

    ... 

    if (table && (section = this.getTableSection(table, section))) { 

     for (ri = 0, rowLen = section.rows.length; ri < rowLen; ri++) { 

      row = section.rows[ri]; 
      tmp = []; 

      if (readAttributes) { 

       // here normally the html attributes of the rows (<tr>) should be extracted 
       // but the code is commented ! 
       tmp.rowAttributes = null; // $.wijmo.wijgrid.getAttributes(row); 
       tmp.cellsAttributes = []; 

      } 

      // here is extracted the html attributes for the cells (<td>) 
      for (ci = 0, celLen = row.cells.length; ci < celLen; ci++) { 
       tmp[ci] = row.cells[ci].innerHTML; 
       if (readAttributes) { 
        tmp.cellsAttributes[ci] = $.wijmo.wijgrid.getAttributes(row.cells[ci], prevent); 
       } 
      } 

      result[ri] = tmp; 
     } 
    } 

    return result; 
} 

我已经做了一个试验用“数据 - ”关于td元素属性和它们不被破坏。

注意:您要使用的选项readAttributesFromData

您可以联系谁开发这个插件问他们为什么注释掉这一行的公司。

+0

现在,这是完全意想不到的。我知道他们在创建自己的网格时删除了这些属性。但希望有一些选择来防止这种情况发生。我没有想到,它可能是一个错误或死代码造成的。 – 2012-01-05 22:34:46