Optimal way to refresh an editor table
Optimal way to refresh an editor table
I have a "mass update" button on my page that applies a mass update to the database, and then refreshes the editor table.
Looking around the various examples, I pieced together this technique. My question is whether there is a better technique than to new up a table. The following code does work.
function refreshTable () {
var refreshTable = $('#example').DataTable();
refreshTable.draw();
}
Without success, I have tried $('#example').draw();
and received in the console log Uncaught TypeError: $(...).draw is not a function
I have also tried $('#example').ajax.reload();
and received the error Uncaught TypeError: Cannot read property 'reload' of undefined
I just wanted to make sure I wasn't missing out on an existing technique that doesn't require newing up a table.
This question has an accepted answers - jump to answer
Answers
You need to add
.DataTable()
to get the APIs. For example:I'm thinking
ajax.reload()
is what you want to use to refresh the data from the DB.Kevin