[英]JQuery Datatables columns overflow
I have problem with my datatable: it has to have a specific width, but also I want to display all its columns. 我的数据表有问题:它必须有一个特定的宽度,但我想显示它的所有列。 The whole issue looks like this:
整个问题看起来像这样:
I found solutions Datatables Width Overflow For A Lot Of Columns and JQuery Datatables overflow , but I would rather use word breaking then have a scrollbar in my table. 我发现解决方案Datatables Width Overflow For the Many Columns和JQuery Datatables溢出 ,但我宁愿使用单词破解然后在我的表中有一个滚动条。
So, I found another solution jQuery DataTable overflow and text-wrapping issues according to which i had to set: 所以,我找到了另一个解决方案jQuery DataTable溢出和文本包装问题,根据我必须设置:
table.display { table-layout:fixed; }
th, td { word-wrap:break-word; overflow:hidden; text-overflow: ellipsis; }
However, with this I had a problem with column width; 然而,有了这个,我的列宽有问题; all columns have same width and option "bAutoWidth: true" is ignored:
所有列都具有相同的宽度,并忽略选项“bAutoWidth:true”:
For example, there is an empty horizontal space in Price column, or after icons at last column. 例如,“ 价格”列中有一个空的水平空格,或者在最后一列的图标后面。 Moreover word-broken headers (th) seem very ugly, and it would look better if Code , Count , Price and Place columns were at their minimum size (their width matched width of header text).
另外,断字头(th)似乎非常难看,如果Code , Count , Price和Place列的最小尺寸(它们的宽度与头文本的宽度匹配),它看起来会更好。
I would like to specify (somehow) preferred width for each column, or after how many letters it should wrap. 我想指定(不知何故)每列的首选宽度,或者它应该包裹多少个字母。 I found breakCellText plugin in this post jQuery DataTable overflow and text-wrapping issues .
我在这篇帖子jQuery DataTable溢出和文本包装问题中找到了breakCellText插件 。 Nevertheless, this plugin is not working with my datatables 1.9.4.
不过,这个插件不适用于我的数据表1.9.4。
I had the same problem. 我有同样的问题。 Here is my solution:
这是我的解决方案:
.dt-index {
column-width: auto !important;
}
Please use this style for your table. 请将此款式用于您的桌子。
I hope that will be your solution. 我希望这将是你的解决方案。
Greetz Vegeta_77 Greetz Vegeta_77
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.