DataTables reset
DataTables reset
danielcambur
Posts: 1Questions: 0Answers: 0
So i'm obviously not good at using the search function, as i've spent the past two hours seraching and trying different things to solve my issue with no joy... So given up, but i wanted to use DataTables, so before i look for an alternative thought i'd ask here!
I have tables which update via ajax using innerHTML() to change the content of the table's tbody. I now want to add pagination, sorting and keyword filtering using the DataTables plugin.
I don't want to change the ajax to use json, as i was looking for a quick fix, and i would have to re-write too many functions. Is there a way i can get DataTables to re-evaluate the html and do it's magic??
[code]
var dTable ;
$(document).ready(function() {
dTable = $('#maintable').dataTable() ;
});
function updateTable(postdata) {
$.ajax({
type: "POST",
url: "ajax.php",
data: postdata,
success: function(response){
//so i'll clear the current content of the dTable
dTable.fnClearTable(true) ;
//now i will replace the content of the table (html returned by ajax call)
$('table.tablesorter tbody').html(response) ;
//now i want to re-initialise data tables with the new html
dTable.????() ;
}
}
});
}
[/code]
I have tables which update via ajax using innerHTML() to change the content of the table's tbody. I now want to add pagination, sorting and keyword filtering using the DataTables plugin.
I don't want to change the ajax to use json, as i was looking for a quick fix, and i would have to re-write too many functions. Is there a way i can get DataTables to re-evaluate the html and do it's magic??
[code]
var dTable ;
$(document).ready(function() {
dTable = $('#maintable').dataTable() ;
});
function updateTable(postdata) {
$.ajax({
type: "POST",
url: "ajax.php",
data: postdata,
success: function(response){
//so i'll clear the current content of the dTable
dTable.fnClearTable(true) ;
//now i will replace the content of the table (html returned by ajax call)
$('table.tablesorter tbody').html(response) ;
//now i want to re-initialise data tables with the new html
dTable.????() ;
}
}
});
}
[/code]
This discussion has been closed.
Replies
Allan