Clear Table during ServerSide reload/redraw
Clear Table during ServerSide reload/redraw
I've seen a few similar questions in past posts, but none with specific resolutions.
When Datatables is in serverSide mode, and the user is filtering or searching the table, while the Processing message is displayed in our use case we could like the table to be cleared. This is for two reasons, one, it's going to be redrawn and changed anyway, but more importantly, our table/page is long enough that often the user can't see the Processing message. Clearing the table and having that message at the top of the tbody would provide a more clear message to users.
At the same time, I've noticed that when there's any rendering delay (related to yadcf or otherwise) using a spinner in place of the Processing message just ends up hanging and not spinning.
Is there anyway to setup DataTables to auto clear the rows whenever processing is triggered? The idea isn't to change any data, but just to have a clean table to be redrawn on.
This question has an accepted answers - jump to answer
Answers
One option is to use the
preXhrevent to clear the table. Use the jQuery empty() method to clear thetbody. For example:http://live.datatables.net/gimicule/1/edit
Kevin
Thanks @kthorngren that did the trick quite well.
@kthorngren saved my day. i was trying to find this solution for 6 months. forgot to find in forum.