fnAddData and tabletools not working
fnAddData and tabletools not working
Trapias
Posts: 3Questions: 0Answers: 0
Hello,
I'm populating my datatable clientside with a custom array of objects: I load a json array from ajax and then manipulate data via fnServerData, where my success function builds an array of cutom columns, and adds rows calling fnAddData.
Something like:
[code]
...
"fnServerData": function( sSource, aaData, fnCallback, oSettings){
oSettings.jqXHR = $.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"success": function( aaData){
populate(aaData);
}
...
//then in populate I call fnAddData for each row I want to add
mytable.fnAddData(jsondata,true);
[/code]
This is working pretty good, except TableTools is not working: I can see the buttons and all formatting is ok, but the only working button is PRINT; Copy only puts "blank" in clipboard, while csv/excelpdf buttons do absolutely nothing - but I see no errors.
I'm using datatables 1.9.4 and tried both the TableTools that comes with it and the new 2.2.0: apart some changes in look I cannot see any difference, only the print button works.
Afaik it's not a problem with the swf path, since I can see buttons. I think I'm missing something else, but what?
Maybe populating the table client-side (bProcessing false, bServerSide false) with fnAddData requires some additional call when I'm done, to tell tabletools to update its view of data?
Thanks for any suggestion,
al.
I'm populating my datatable clientside with a custom array of objects: I load a json array from ajax and then manipulate data via fnServerData, where my success function builds an array of cutom columns, and adds rows calling fnAddData.
Something like:
[code]
...
"fnServerData": function( sSource, aaData, fnCallback, oSettings){
oSettings.jqXHR = $.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"success": function( aaData){
populate(aaData);
}
...
//then in populate I call fnAddData for each row I want to add
mytable.fnAddData(jsondata,true);
[/code]
This is working pretty good, except TableTools is not working: I can see the buttons and all formatting is ok, but the only working button is PRINT; Copy only puts "blank" in clipboard, while csv/excelpdf buttons do absolutely nothing - but I see no errors.
I'm using datatables 1.9.4 and tried both the TableTools that comes with it and the new 2.2.0: apart some changes in look I cannot see any difference, only the print button works.
Afaik it's not a problem with the swf path, since I can see buttons. I think I'm missing something else, but what?
Maybe populating the table client-side (bProcessing false, bServerSide false) with fnAddData requires some additional call when I'm done, to tell tabletools to update its view of data?
Thanks for any suggestion,
al.
This discussion has been closed.
Replies
Allan
1. Updated the tabletools library from 2.1.4 to 2.2.0
2. Also the tabletools library 2.2.0 had an issue with duplicate declaration, after fixing this
The fnAddData and tabletools worked just great.
Thanks for all the support and the libraries.
Allan