Hiding columns and having scrollX
Hiding columns and having scrollX
Hi all,
I am new to datatables but i starting liking them since very flexible to use.
I have created a datatable with "scrollX": "100%"
i have hidden a column using ": [ { "targets": 0, "orderable": false, "visible": false },...]
For some reason or another, the column's width gets distorted and the header columns are not aligned with the body columns. But when i removed the "scrollX": "100%"
, the columns took the full width of the table and the header columns are not aligned with the body columns.
Is this a bug or there is an explanation about this?
Thanks in advance
This question has accepted answers - jump to:
Answers
Do the number of columns in the body match number in header? What version of DataTables are you using? In DataTables 1.10, "scrollX" takes a boolean value.
However, there are a number of things you can go.
Add following to table DOM
Add following to .DataTable() init
Make sure your th & td DOM elements "box-sizing" match following
This last one is optional and only worth a shot if you still haven't fixed your issue. Add following to .DataTable() init
scrollX is a Boolean, it's either true or false.
You want to change the width, mostly likely in the table element style.
"autoWidth" : false
did the trick.
changing scrollX to a boolean, wasn't so effective but i changed it just in case :)
thank you guys