multiple tables and ajax

multiple tables and ajax

quanhquanh Posts: 2Questions: 0Answers: 0
edited October 2010 in General
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.

Replies

  • quanhquanh Posts: 2Questions: 0Answers: 0
    nevermind. Problem was caused by an extraneous single quote being added to the guid on the ajax callback.
This discussion has been closed.