I want to set a static width for all columns of a DataTables (with a scroll plugin).
This makes the columns wider if I set the width for all <th> tags except one. And this does not work if the width is set for all tags. In addition, when I check the developer tools, I do not see the <th> element with a width of 400px . Elements have different widths: 115px , 132px , 145px ...
Why? How to set exact column width?
CSS
.big-col { width: 400px; }
Js
var options = { "sScrollX": "100%", "sScrollXInner": "110%", "bScrollCollapse": true, "colReorder": true }; $(document).ready(function() { $('#example').dataTable(options); });
Full example: http://fiddle.jshell.net/sergibondarenko/o1hoabep/8/
Also, I tried the columnDefs option without success.
var options = { "columnDefs": [ { "width": "100px", "targets": "_all" } ] };
The exact number of columns is unknown. The HTML table is built dynamically based on data from the server side.
source share