Calling .draw() but not cause a new server request?
Calling .draw() but not cause a new server request?
I basically have a serverSide datatable that is loaded hidden at start but when the table is visible I was using the 'trick' on the adjust page: https://datatables.net/reference/api/columns.adjust()
table.columns.adjust().draw();
The problem I have now since upgrading to 1.12.1 is that the server is called twice when this table initializes (one normal call and another provoked by draw()). Before 1.10.25 there was actually a bug preventing this ajax call duplication.
But to put it simply: is there any way to call draw() but force it to not trigger a new ajax request? I really just want the columns to resize and to have that visible.
Answers
Do you really need the
draw()
in that chain? Could you just usetable.columns.adjust()
?Allan
My understanding is that we need to call draw to 'see' the changes made by table.columns.adjust() ? at least the reference page I linked clearly shows in the example to call the .draw().
Any chance we can get an option on .draw() to trigger serverSide update or not?
No - a
draw()
call will aways hit the server-side whenserverSide
is enabled I'm afraid.Don't think so. the column sizes will still be adjusted.
That's me trying to cover all bases! Some plug-ins use events on
draw
and not columns adjust.It might be worth trying it without the
draw()
call if you haven't already.Allan