fnAddData fail with aoData is nul when working on n instance of the table

fnAddData fail with aoData is nul when working on n instance of the table

califlocaliflo Posts: 1Questions: 0Answers: 0
edited February 2012 in Bug reports
Hi, I am trying to use the fnAddData option and i got the following problem.
The table is first initiliazed dynamically and adding a new row with fnAddData is working fine, but if i recreate the table in the same DOM then the fnAddData command fails and the aoData is null message is displayed. I am not sure that the code of jstable in the reason of that.

I have attach an extract of the minimum set of code that reproduce the problem.

A very simple page that display two button
one that call the display of the div and the loading of the pbjstable2.js code

[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



Document sans nom




<!--Code used for the table management -->

@import "/javascripts/jstable/css/demo_page.css";
@import "/javascripts/jstable/css/demo_table_jui.css";





















 

[/code]

The pbjstable.js code that is loaded with the page

[code]$(document).ready(OnReady);

function OnReady()
{
$("#cleardiv").click(function() {
$('#maincontent').empty();
$('#maincontent').append('Column 1Column 2etc');
$.getScript("/talaris/pbjstable2.js");
});
}; [/code]


the code pbjstable2.js that is loade each time i clean the div and recreate the table

[code] $(function() {
//define a table of a list of devices
var updtbl = $('#devicelisttable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers" ,
"bDestroy": true,
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
//"bSort": true,
"bInfo": false,
"bAutoWidth": false,

});


$("#add").click(function() {
updtbl.fnAddData( ['1', '2', '3'],true);
});


}); [/code]

Hope it will help, because i a no idea of the cause of that.
Thanks
This discussion has been closed.