DataTable:如何使某个列加粗和居中?

时间:2015-02-18 21:32:29

标签: css datatables jquery-datatables

我使用了DataTable,我希望将某个列加粗并将其放在中心。我怎么做 ?

现在是我的设置:

  // Setting to Inventory Table 
  $('#inventory_exact').dataTable({

    "lengthMenu": [ 10 ] ,
    "bLengthChange": false,
    "searchHighlight": true,
    "bInfo" : false,
    "bRegex" : false,
    "bSmart" : false,
    "sSearch" :"^\\s*"+'1'+"\\s*$"


  });

现在看来是这样的:

enter image description here

1 个答案:

答案 0 :(得分:4)

为什么你不能使用简单的CSS?假设您希望第三列以粗体显示,文本与中心对齐:

#inventory_exact td:nth-child(3),
#inventory_exact th:nth-child(3) {
    text-align : center;
    font-weight: bold;
}

jQuery dataTables 1.10.x demo - >的 http://jsfiddle.net/1s1kfzja/