需要從我的自定義按鈕調用csv按鈕。如何從自定義按鈕調用數據表csv按鈕
<button value="Export report to Excel" class="button-default datatable-csv" type="button" id="ExportReporttoExcel">
<span>Export report to Excel</span>
</button>
而不是從數據表按鈕調用它,我想從上面的按鈕相同的功能。
在Datatable中查找一些配置更改,以便我可以調用我的自定義按鈕將表記錄導出爲csv。
var table=$('#tableId').DataTable({
"paging": true,
"info": true,
"searching": true,
,buttons: true
});
$("#SEARCH").on("keyup search input paste cut", function() {
table.search(this.value).draw();
});
var buttons = new $.fn.dataTable.Buttons(table, {
buttons: [
'csvHtml5'
]
}).container().appendTo($('#ExportReporttoExcel'));
獲得如下輸出,但我只需要一個按鈕。
你就不能添加'的onclick = 「yourFunction中()」'屬性? –
當你說「調用按鈕」,你的意思是務實地點擊它的權利? –
是內維爾Nazerane,需要將表格導出到CSV文件 – MPPNBD