需要从我的自定义按钮调用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