Hi everybody,
I use Table tools like this :
And my generate_csv.php :
But, when i click on Download CSV, there's nothing happened.
Any idea ?
Magali
I use Table tools like this :
TableTools.BUTTONS.download = { "sAction": "text", "sTag": "default", "sFieldBoundary": "", "sFieldSeperator": "\t", "sNewLine": "<br>", "sToolTip": "", "sButtonClass": "DTTT_button_text", "sButtonClassHover": "DTTT_button_text_hover", "sButtonText": "Download", "mColumns": "all", "bHeader": true, "bFooter": true, "sDiv": "", "fnMouseover": null, "fnMouseout": null, "fnClick": function( nButton, oConfig ) { var oParams = this.s.dt.oApi._fnAjaxParameters( this.s.dt ); var iframe = document.createElement('iframe'); iframe.style.height = "0px"; iframe.style.width = "0px"; iframe.src = oConfig.sUrl+"?"+$.param(oParams); document.body.appendChild( iframe ); }, "fnSelect": null, "fnComplete": null, "fnInit": null }; $(document).ready(function() { // Affichage du tableau avec le détail des entrées $('#tabDetail').dataTable({ "bProcessing": true, "bServerSide": true, "sDom": 'T<"clear">lfrtip', "oTableTools": { "aButtons": [{ "sExtends": "download", "sButtonText": "Download CSV", "sUrl": "generate_csv.php" }] }, "sAjaxSource": "serverSide_general.php", "fnServerData": function( sUrl, aoData, fnCallback ) { $.ajax( { "url": sUrl, "data": aoData, "success": fnCallback, "dataType": "json", "cache": false } ); } })
And my generate_csv.php :
<?php header('Content-Type: application/csv-tab-delimited-table'); header('Content-Disposition: attachment'); $csv = '"Usager";"Prénom";"Prénom";"Prénom";"Prénom";"Prénom";"Email"'."\n"; echo json_encode($csv); exit; ?>
But, when i click on Download CSV, there's nothing happened.
Any idea ?
Magali