$('#example').DataTable( {
dom: 'T<"clear">lfrtip',
"bPaginate": false,
"bSort" : false,
"bFilter": false,
tableTools: {
"aButtons": [
{
"sExtends": "xls",
"sButtonText": "Download Excel",
"sTitle": '<?php echo $name['first_name'].'-'.$name['last_name'].'-'.$name['id'];?>',
"oSelectorOpts": {
page: 'current'
}
},
{
"sExtends": "pdf",
"sButtonText": "Download PDF",
"sTitle": '<?php echo $name['first_name'].'-'.$name['last_name'].'-'.$name['id'];?>',
"sPdfOrientation": "landscape",
"sPdfMessage": "<?php echo $name['first_name'].' '.$name['last_name'].' PreApp 1003 Application Details'; ?>"
},
{
"sExtends": "mae",
"sButtonText": "Download in Fannie-Mae",
"sTitle": '<?php echo $name['first_name'].'-'.$name['last_name'].'-'.$name['id'];?>',
"sPdfOrientation": "landscape",
}
]
}
} );
答案 0 :(得分:0)
TableTools
扩展程序不支持该功能https://datatables.net/extensions/tabletools/的HTML5
版本。由于它现在已经退役,所以不要指望这个功能可用。
但是,TableTools
已转换为另一个Buttons
https://datatables.net/extensions/buttons/扩展程序,该扩展程序同时支持HTML5
和SWF
版本。
$(document).ready(function() {
$('#table').DataTable( {
dom: 'Bfrtip',
buttons: [
'copyHtml5',
'excelHtml5',
'pdfHtml5'
]
} );
} );
在此处查看更多示例https://datatables.net/extensions/buttons/examples/html5/index.html