Responsive table and StateSave

Responsive table and StateSave

gwlavagwlava Posts: 0Questions: 0Answers: 0

Hi,
I've created a responsive table and also implemented the StateSave option which all was working great.
I did notice one problem:
• I had a table that already had columns hidden via the responsive extension
• I filtered the table that so that a row with a long piece of data in a column was hidden.
• I navigated away from the page containing the table and then returned to the page so that the search filter was still applied.
• When I cleared the filter, the hidden row which had required one of the columns to be widened reappeared and the table lost it's responsiveness i.e. the columns that had been hidden reappeared and the table went wider than it's container.

My workaround was to add the following code which I got the idea from this post https://datatables.net/forums/discussion/31213/table-body-too-wide-not-hiding-columns-on-resize#latest

var table = $('#myDataTable').DataTable();
table.on('search.dt', function () {
table.responsive.recalc();
});

Is this normal behaviour and is the workaround expected or should the datatable detect that responsive is enabled and resize after a search filter change?
Thanks.

This discussion has been closed.