javascript - 标题中的单独列过滤。如何单独更改每列的搜索过滤器文本框的宽度?

标签 javascript datatable

在我的 JavaScript 代码中,为所有搜索文本框设置了一个样式宽度值,并且我无法一一调整它们的大小。

$('#detailed thead th').each( function () {
    var title = $('#detailed thead th').eq( $(this).index() ).text();
    $(this).html( '<input type="text" class="popoverData" data-content="Please enter a '+title+'" rel="popover"' +
        ' data-placement="bottom" data-trigger="hover" style="width:80;" placeholder="'+title+'" />' );

最佳答案

您可以设置个人 <input> 的样式通过简单的 CSS 实现:

#detailed thead th:nth-child(1) input {
  width: 30px !important;
  max-width: 30px !important;
}

#detailed thead th:nth-child(3) input {
  width: 80px !important;
  max-width: 80px !important;
}

等等。如果您发现问题(我没想到),请设置 autoWidth: false

关于javascript - 标题中的单独列过滤。如何单独更改每列的搜索过滤器文本框的宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38071768/

相关文章:

c# - 如何将值添加到数据表C#中的特定列和行的值

javascript - 有没有办法为 Node js https 请求设置源端口?

c# - 访问数据表的单元格值

c# - 检查列是否返回空值的最佳方法(从数据库到 .net 应用程序)

css - p :dataTable: Trigger rowSelect event when click embedded content (image)

c# - 使用 Compact Framework 在数据网格中设置列宽

javascript - 两次 httpRequest 后解析、saveAll 失败(云代码作业)

javascript - 如果没有选择要上传的文件,如何从复选框中删除复选框?

javascript - 在 Android 上使用 PhoneGap 进行地理定位仅适用于 index.html

javascript - Firestore——仅获取大型同步集合中已更改的文档