Copy and Export Don't See New Data After DataTables Refreshed
Copy and Export Don't See New Data After DataTables Refreshed
hwankle
Posts: 1Questions: 0Answers: 0
I am using Table Tools 2 with DataTables 1.7.6 and everything seems to work fine until the the source DataTables object is refreshed with a new recordset. After the refreshed data displays on the screen, the Copy and Export features still output the original dataset.
How can I cause the TableTools plugin to refresh itself whenever I refresh the data in the associated DataTable?
Thanks!
Henry
How can I cause the TableTools plugin to refresh itself whenever I refresh the data in the associated DataTable?
Thanks!
Henry
This discussion has been closed.
Replies
I've modified the TableTools 'export' button to refresh teh DataTables data via ajax call. However, even when i see the table's data refreshed, TableTools saves the old data to file.
[code]
var fetchMessages, oTable;
oTable = jQuery("#client-detail").dataTable({
'bProcessing': true,
'bServerSide': true,
'bRetrieve': false,
'sServerMethod': 'POST',
'sAjaxSource': 'http://localhost:3000/admin/clients/2/client_detail.json?records_requested=contacts&client_id=2',
'sDom': 'T<"clear">lfrtip',
'oTableTools': {
'sSwfPath': '/swf/copy_csv_xls.swf',
'aButtons': [
{
'sExtends': 'xls',
'sFileName': 'ExpressText - *.xls',
'sTitle': 'ET (Admin Export)',
'sButtonText': 'Export Messages (Excel Format .XLS)',
'sToolTip': "Export your clients' data",
'fnClick': function(nButton, oConfig, oFlash) {
console.log('export xls button clicked');
fetchMessages();
this.fnSetText(oFlash, this.fnGetTableData(oConfig));
return console.log('--oconfig is: ' + oConfig[0]);
}
}
]
},
'sScrollY': '350px',
'iDisplayLength': 25,
'oLanguage': {
'sLengthMenu': 'Purchases Per Page _MENU_ '
},
'sPaginationType': 'full_numbers'
});
fetchMessages = function() {
console.log('- fetching contacts for dataTable ');
oTable.fnReloadAjax('http://localhost:3000/admin/clients/2/client_detail.json?records_requested=inbox&client_id=2');
return setTimeout(function() {
return console.log('--delay 3000 ms');
}, 3000);
};
[/code]