我在MVC4 ASP.NET Web应用程序中使用Jquery DataTable TableTool。导出到Excel和PDF与Chrome配合良好。但不适用于IE和FireFox。 我的代码如下:
dom: 'T<"clear">lfrtip',
tableTools: {
"sSwfPath": "../media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "xls",
"sFileName": "Orders.csv",
"bFooter": false,
"mColumns": "visible",
"bHeader":false
}
]
},
任何人请帮帮我
答案 0 :(得分:0)
var oTable1 = $('#Ccctbl').dataTable({
"bPaginate": true,
"bDeferRender": true,
"bProcessing": true,
"bJQueryUI": true,
"sDom": '<"toolbar">frtip',
"sAjaxSource": "/Setup/LoadCostCenterCategory/",
"iDisplayLength": 15,
"bDestroy": true,
"fnPreDrawCallback": function (oSettings, json) {
var id = $(this).attr('id');
$("#ToolTables_" + id + "_0").html("<i class='icon-copy bigger-120 blue'></i>")
$("#ToolTables_" + id + "_1").html("<i class='icon-file-text green bigger-120'></i>")
$("#ToolTables_" + id + "_0").attr("title", "Copy");
$("#ToolTables_" + id + "_1").attr("title", "Export To Excel");
},
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"oTableTools": {
"sSwfPath": "//cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls.swf",
"aButtons": [
{
'sExtends': 'copy',
"oSelectorOpts": { filter: 'applied', order: 'current' },
},
{
'sExtends': 'xls',
"oSelectorOpts": { filter: 'applied', order: 'current' },
}
]
},
"aoColumns": [
{ "mData": "CODE", "sTitle": "Cost Center Category Code", "sWidth": "25%", "bSortable": false },
{ "mData": "DESCRIPTION", "sTitle": "Description", "sWidth": "25%", "bSortable": false },
{ "mData": "strsegcattype", "sTitle": "Segment", "sWidth": "25%", "bSortable": false },
{ "mData": "strIsActive", "sTitle": "Active", "sWidth": "25%", "bSortable": false },
]
});