Exporting Not Working
Exporting Not Working
ureshpatel5
Posts: 25Questions: 0Answers: 0
Hi,
I have implemented the data table and trying to put the export buttons on the page.iput all the code mentioned in forums and examples.
[code]
..
..
..
$(document).ready( function () {
$('#example').dataTable( {
"bRetrieve" : true,
"sDom": '<"H"Tfr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "http://datatables.net/release-datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "print",
"sButtonText": "Print",
"bShowAll": true,
"sMessage": "Record Data",
},
{
"sExtends": "pdf",
"sButtonText": "Export to PDF"
},
{
"sExtends":"xls",
"sButtonText": "Export for Excel"
}
]}
});
} );
[/code]
I have implemented the data table and trying to put the export buttons on the page.iput all the code mentioned in forums and examples.
[code]
..
..
..
$(document).ready( function () {
$('#example').dataTable( {
"bRetrieve" : true,
"sDom": '<"H"Tfr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "http://datatables.net/release-datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "print",
"sButtonText": "Print",
"bShowAll": true,
"sMessage": "Record Data",
},
{
"sExtends": "pdf",
"sButtonText": "Export to PDF"
},
{
"sExtends":"xls",
"sButtonText": "Export for Excel"
}
]}
});
} );
[/code]
This discussion has been closed.
Replies
Allan mentioned in one thread that you should not point to SWF on datatables.net. Instead use local file for that. Maybe that is the problem?
i downloaded all the new version.and still give this error
Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download
@version 1.9.4
Can you tell me how you resolved this issue. the save option is not working in my code
here is my instanciation code :
[code] $(document).ready(function() {
$('#myTable').dataTable({
"sDom": "<'row-fluid'<'span4'l><'span3'T><'span5'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"oTableTools": {
"sSwfPath": "js/swf/copy_csv_xls_pdf.swf",
"aButtons": [
"copy",
"print",
{
"sExtends": "collection",
"sButtonText": 'Enregistrer ',
"aButtons": [ "csv", "xls", "pdf" ]
}
]
}
});
[/code]
The table displays good and the export dropdown button is showing as in the plugin, but the buttons dont work.
Any idea ????
[code]
$(document).ready( function () {
$('#example').dataTable( {
"bRetrieve":true,
"sDom": 'T<"clear">tip',
"oTableTools": {
"aButtons": [
{
"bFooter": true,
"sExtends": "copy",
"sButtonText": "Copy",
"mColumns": [ 1,2,3,4,6,7 ]
},
{
"bFooter": true,
"sExtends": "print",
"sButtonText": "Print",
"mColumns": [ 1,2,3,4,6,7 ]
},
{
"bFooter": true,
"sExtends": "xls",
"sButtonText": "XLS",
"sFileName": "*.xls",
"mColumns": [ 1,2,3,4,6,7 ]
},
{
"bFooter": true,
"sExtends": "csv",
"sButtonText": "CSV",
"mColumns": [ 1,2,3,4,6,7 ]
},
{
"bFooter": true,
"sExtends": "pdf",
"sButtonText": "PDF",
"mColumns": [ 1,2,3,4,6,7 ]
}
]
}
} );
} );
[/code]
I tried your solution. But I still have the same problem, although the copy button works fine, but the other save options (to pdf, xcl, csv) don't do anything
PS : as I'm using Bootstrap, I use the Dom Definition as below :
[code]
"sDom": "<'row-fluid'<'span4'l><'span3'T><'span5'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
[/code]
instead of :
[code]
"sDom": 'T<"clear">tip',
[/code]