我正在使用jQuery数据表。我需要在工具栏中导出excel和clolVis(col visible / hide)按钮。我使用以下代码,但导出excel按钮不在IE中显示。我正在使用IE10。
function DrawAllFundTable() {
$("#AllFundsData").empty();
$("#AllFundsData").html('<table class="display table table-hover table-striped VF-table" width="100%" id="AllFundsData-Table"></table>');
AllFundsTable = $('#AllFundsData-Table').dataTable({
"data": AllFundDataEquity,
"aaSorting": [[0, "asc"]],
"dom": 'T<"clear">ft<"bottom"p>',
"language": {
"sSearch": "Search"
},
"iDisplayLength": 10,
"columnDefs": [
{ "targets": [0], "searchable": true, "visible": true, "title": "Fund", "sortable": true, "className": "col-xs-3" },
{ "targets": [1], "searchable": true, "visible": false, "title": "Sub Type", "sortable": true, "className": "col-xs-1" },
.....Other columns....
],
"sDom": '<"toolbar">lC<"H"Tfr>t<"F"p>',
"oColVis": {
"buttonText": "Show / hide columns",
"bRestore": true,
"sAlign": "left"
},
"oTableTools": {
"sAlign": "left",
"sSwfPath": "assets/swf/copy_csv_xls.swf",
"aButtons": [
{
"sButtonText": "Export to Excel",
'sExtends':'xls',
'mColumns':'visible', //set which columns here
"oSelectorOpts": { filter: 'applied', order: 'current' },
"sButtonClass": "back_image"
} ]
}
});
}
这适用于Chrome,但我需要它应该可以在IE中使用。
Datatable JS
<script type="text/javascript" src="//cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/plug-ins/f2c75b7247b/integration/bootstrap/3/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/colvis/1.1.2/js/dataTables.colVis.min.js"></script>
<%-- <script type="text/javascript" src="http://cdn.datatables.net/colreorder/1.1.3/js/dataTables.colReorder.min.js"></script>
--%>
<script type="text/javascript" src="http://datatables.net/release-datatables/extensions/TableTools/js/dataTables.tableTools.js"></script>
CSS
<link href="http://cdn.datatables.net/colvis/1.1.2/css/dataTables.colVis.css" rel="stylesheet" />
<%-- <link href="http://cdn.datatables.net/colreorder/1.1.3/css/dataTables.colReorder.css" rel="stylesheet" /> --%>
<link href="http://datatables.net/release-datatables/extensions/TableTools/css/dataTables.tableTools.css"
rel="stylesheet" />