JQuery数据表列溢出 [英] JQuery Datatables columns overflow

查看:122
本文介绍了JQuery数据表列溢出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的datatable的问题:它必须有一个特定的宽度,但也要显示其所有的列。整个问题如下所示:







我找到解决方案 jQuery DataTable溢出和文本包装问题。然而,这个插件不能与我的数据库1.9.4。

解决方案

我有同样的问题。这是我的解决方案:

  .dt-index {
column-width:auto!important;
}

请为您的表格使用此样式。



我希望这将是您的解决方案。



Greetz
Vegeta_77


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.

So, I found another solution jQuery DataTable overflow and text-wrapping issues according to which i had to set:

  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:

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

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. Nevertheless, this plugin is not working with my datatables 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

这篇关于JQuery数据表列溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆