2012-01-04 67 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