multiple tables and ajax
multiple tables and ajax
I'm a noob to jquery and dataTables and haven't been able to figure this out.
I have multiple tables on a page - some of which use dataTables and some of which don't. The data in each table can be refreshed via an ajax call. The problem is that dataTables formatting becomes unstable for the table that is refreshed. By "unstable" I mean - the row alternating colors disappear (or only work for 1/2 of the table), the pagination disappears, etc. This only impacts tables that were refreshed via ajax. The tables all have guids as table id's.
here's an example of initilization (this works just fine):
[code]
$(document).ready(function() {$(#" + [Guid] + ").dataTable();} );"
[/code]
here's the ajax callback (str1 contains the data already in a table with the same guid for an ID. and MyTableId is the table guid):
[code]
function rec_response(str1) {
$get(MyDivId).innerHTML = str1;
$("#" + [Guid]).dataTable()
};
[/code]
thanks for the help.
I have multiple tables on a page - some of which use dataTables and some of which don't. The data in each table can be refreshed via an ajax call. The problem is that dataTables formatting becomes unstable for the table that is refreshed. By "unstable" I mean - the row alternating colors disappear (or only work for 1/2 of the table), the pagination disappears, etc. This only impacts tables that were refreshed via ajax. The tables all have guids as table id's.
here's an example of initilization (this works just fine):
[code]
$(document).ready(function() {$(#" + [Guid] + ").dataTable();} );"
[/code]
here's the ajax callback (str1 contains the data already in a table with the same guid for an ID. and MyTableId is the table guid):
[code]
function rec_response(str1) {
$get(MyDivId).innerHTML = str1;
$("#" + [Guid]).dataTable()
};
[/code]
thanks for the help.
This discussion has been closed.
Replies