Reload Table
Reload Table
starodub
Posts: 6Questions: 2Answers: 0
Hi, i need u help again
i need reload my table after click on btn #refresh, but this not working(
var table;
function main_table() {
$(document).ready(function () {
table = $('#example').DataTable({
ajax: {
url: '/project/all_items/',
dataSrc: ''
},
"sScrollY": "90vh",
"bPaginate": true,
"aoColumns": [
...
],
});
}
function refresh() {
$('#refresh').click( function() {
table.ajax.reload();
}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
My guess is that the
refresh()
function is not being executed. I would just put this code in the$(document).ready()
function under the DT init code:Kevin
thanks, @kthorngren
yep, i know it's working, but i need outside document ready (it's important)
I found a solution
$('#example').DataTable().ajax.reload();
thanks it works)