Columns not adjusting
Columns not adjusting
k_poehler
Posts: 3Questions: 1Answers: 0
Hi, I'm importing a full table pre-drawn from ajax, but when applying dataTable all columns and even the table shrink to its minimum witdh. This is what I'm using:
$("#tabla").DataTable({
"scrollX": true,
"scrollCollapse":true,
"sort": false,
"sDom": 'Tt',
"tableTools": {
"sSwfPath": "../js/plugins/DataTables-1.10.2/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
"aButtons": [
"copy",
"xls",
{
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"sPdfMessage": "mensaje",
"sTitle": "Titulo"
}
]
}
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Try adding below to your config, this might be causing your issue.
https://datatables.net/reference/option/autoWidth
Outside of this, would need to see what the table HTML looks like to better be able to assist you.
@jr42.gordon Thank you, I've tryed to do that though it didn't worked. In the end I ended up solving it doing:
but I would still know why the need to do this, so my table looked like :
That was going to be my next suggestion. When you initialize your DataTable, is it visible? If not, then that is why that code is needed. DataTables doesn't know the dimensions of its container as it isn't visible.
@jr42.gordon Really Thank you, you're right, when initialized is hidden. I though for a moment it could be something related to that, but fixing it was more troublesome than the other.