Using DataTables within a page loaded via ajax

Using DataTables within a page loaded via ajax

baird.rtbaird.rt Posts: 1Questions: 0Answers: 0
edited April 2011 in General
I'm attempting to use datatables within a page that is being loaded via ajax. I just learnt that ajax loads strip out all [code] [/code] tags, which makes initiating the table somewhat of a challenge.

I landed on doing this by simply initiating the table in a function after the ajax successfully loads.
[code]
$.ajax({
url: '<%=Url.Action("Index", "ActivityLog", new{lawsuitId = Model.LawsuitId})%>',
cache: true,
success: function (html) {
$("#tabs-case-activity").append(html);
var oTable = $('#activity-log-list').dataTable({ "oLanguage": { "sSearch": "Search all columns:"} });
}
});
[/code]

... which seems to work with the exception of an error thrown by datatables (jquery.datatables.js) at line 2981 (last line below).

[code]
/* Cache the footer elements */
if ( oSettings.nTFoot !== null)
{
iCorrector = 0;
anTr = oSettings.nTFoot.getElementsByTagName('tr');
var nTfs = anTr[0].getElementsByTagName('th');
[/code]

if I add some additional logic to the if statement...

[code]
/* Cache the footer elements */
if ( oSettings.nTFoot !== null && oSettings.nTFoot.firstChild != null)
[/code]

... all is well.

A.) Am I using datatables correctly in this situation?

B.) Is this a bug within datatables?

C.) Is there someway for me to contribute that fix to the product?

Thanks for all the great work!
BB
This discussion has been closed.