I'm trying to resize jquery Datatables to fit the screen size. Datatables runs in server-side mode (property "serverSide": true
). When the window size is changed I make recalculation of new datatables height and then call draw(false)
to redraw the layout of datatable.
Unfortunately, the draw()
method makes an ajax call and this makes the solution unusable, because it shows "processing" and takes time to get the data on every small window change.
How to redraw datatables layout without calling AJAX? I don't need to refresh data, I just want to redraw the table.
I replaced the calling of table.draw(false)
to table.columns.adjust()
. It renders the table with new height and width without an AJAX call, so the issue is resolved for me. However it would be nice to know the proper way to render dataTables without an AJAX call in server-side mode.