header and table body are not in proper alignment datatable

时间:2017-06-19 13:59:27

标签: css angularjs datatables scroller

//In dtOption I am giving 
   .withOption('scrollY','auto')
<table datatable dt-columns="dtColumns" dt-options="dtOptions"  style="width:100%;"></table>

But due to this, the header and remaining body are not in proper alignment. I tried various options but the issue is not fixed. Please suggest something what to do to fix that problem. I have attached the screenshot of the table. enter image description here

1 个答案:

答案 0 :(得分:0)

一种解决方法是:

$('#DataTableID').DataTable({
  //"scrollX": true,            
  "initComplete": function (settings, json) {  
    $("#DataTableID").wrap("<div style='overflow:auto; width:100%;position:relative;'></div>");            
  },
});