TableTools not working, exporting empty CSV file.
TableTools not working, exporting empty CSV file.
This is my code:
$("#tblItemList").dataTable({
bProcessing: true,
sAjaxSource: '@Url.Action("LoadItemList")',
bJQueryUI: true,
sProcessing: "<img src='~/Images/spinner.gif' />",
dom: 'T<"clear">lfrtip',
bAutoWidth: false,
"aoColumns": [
{"sWidth":"1%", sClass: "smallFonts"},
{ "sWidth": "3%", sClass: "smallFonts" },
{ "sWidth": "2%", sClass: "smallFonts" },
{ "sWidth": "7%", sClass: "id" },
{ "sWidth": "7%", sClass: "smallFonts" },
{ "sWidth": "7%", sClass: "smallFonts" },
{ "sWidth": "7%", sClass: "smallFonts" },
{ "sWidth": "7%", sClass: "smallFonts" },
{ "sWidth": "7%", sClass: "smallFonts" },
{ "sWidth": "8%", sClass: "id" },
{ "sWidth": "7%", sClass: "smallFonts" },
{ "sWidth": "7%", sClass: "smallFonts" },
{ "sWidth": "7%", sClass: "smallFonts" },
{ "sWidth": "7%", sClass: "smallFonts" }
],
tableTools: {
"sSwfPath": "../../Scripts/swf/copy_csv_xls_pdf.swf", //'<c:url value="../../scripts/swf/copy_csv_xls_pdf.swf"/>', //"//cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf", //
"aButtons": [{
sExtends: 'csv',
mColumns: "visible",
oSelectorOpts: { "filter": "applied" },
"fnClick": function (nButton, oConfig, oFlash) {
oFlash.setFileName("c:\Dean\saved.csv");
this.fnSetText(oFlash, this.fnGetTableData(oConfig));
}
}]
}
});
$("#tblItemList").dataTable().columnFilter();
$("#tblItemList").dataTable().fnSetColumnVis(0, false);
But the file is always zero length.