Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataTables.net programmatic refresh

I am using DataTables (jQuery plugin) to display my tabular data. If fetches data using AJAX from a JSON web service.

How do I force it to refresh using JavaScript/jQuery? I am looking through the API and cannot find the right function.

like image 673
Lou Avatar asked Dec 08 '25 13:12

Lou


2 Answers

While waiting for the answers, I finally found it: fnDraw function is what I needed.

It's described at the beginning of the API section, but I just didn't bother to read it all:

You must make the required calls to the server to manipulate your data as required, and then simply redraw the table (fnDraw) to view the new data.

like image 64
Lou Avatar answered Dec 10 '25 03:12

Lou


Try calling:

$("#Table1").fnDestroy().dataTable();

That should rebuild it...

like image 39
Paul Grimshaw Avatar answered Dec 10 '25 03:12

Paul Grimshaw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!