如何在JQuery数据表V1.9.4中动态改变宽度

How to change the width dynamically in JQuery datatables V1.9.4

本文关键字:动态 改变 JQuery 数据表 V1      更新时间:2023-09-26

宽度在数据表中是动态的,即使给了内联宽度。

我可以用inline width

来控制动态宽度吗?

您可以将!important添加到您的内联样式中,但您应该只需要将其应用于th元素,然后同一列中的每个<td>都应该继承该宽度。

<tr>
  <th style="width: 100% !important;">Heading</th>
</tr>

您还应该能够使用正确的初始化选项关闭它:

$('#example').dataTable({
    "autoWidth": false
});
https://datatables.net/reference/option/autoWidth