0

I have a jQuery data-table which I specified the column width likes following:

"aoColumnDefs":[
  { "sWidth":"40%" },
  { "sWidth":"10%" },
  { "sWidth":"50%" } ]

I also specified the CSS style like:

  td { position: relative, word-wrap: break-word; }

The table displays exactly as I wanted, long entries have been wrapped. However, when I sorted on the second column (the sorting is handled by the back-end server), some of the values of the first column are long but never broke and wrapped. The table showed only one column (due to the longest length of the value exceeded the table width).

How can I get the data-table obey the initialized width and render correctly?

4

1 回答 1

1

您可以尝试使用该sClass列中单元格的属性来设置样式去这里http://datatables.net/ref并向下滚动 sClass 参考。

"aoColumnDefs":[
  { "sWidth":"40%", "sClass":"relative-postition-and-break-word" },
  { "sWidth":"10%", "sClass":"relative-postition-and-break-word" },
  { "sWidth":"50%", "sClass":"relative-postition-and-break-word" } ]

(长类名只是为了说明您的类将具有什么作为 css)

于 2011-10-20T22:24:48.010 回答