After hiding a column table responsiveness no longer functions on window resize

After hiding a column table responsiveness no longer functions on window resize

mkaszubamkaszuba Posts: 1Questions: 0Answers: 0
edited October 2019 in Free community support

when using the default datatables call: $('#example').DataTable(); everything works just fine. If I add the option to hide the first column via this:
$('#example').DataTable({
"columnDefs": [
{
"targets": [ 0 ],
"visible": false,
"searchable": false
}
]
});

the responsiveness of the table disappears. It takes a screen refresh to have the table redraw to the size of the window. What am I doing wrong/forgetting here? I am looking to hide the first column but maintain the responsiveness on window resize.

Replies

  • kthorngrenkthorngren Posts: 21,163Questions: 26Answers: 4,921

    but maintain the responsiveness on window resize.

    Could be lots of things but maybe you need to use responsive.recalc() after resizing the window.

    Maybe you need to add style="width:100%" to your table tag to allow Datatables to calculate the table width.

    If this doesn't help then we will likely need to see a link to your page or a test case replicating the issue. This way we can see exactly what you have to offer suggestions.

    Kevin

This discussion has been closed.