'Data table Print, pdf EXPORT and CSV NOT WORKING IN Electron app
I am developing an Electron js application and new in data table. i have added print and export option on my script. unfortunately blank popup screen showing when press on print button. CSV, PDF export button not appearing in the screen.
Can any one help to solve this issue?
here is my complete script
var $ = require( 'jquery' );
var dt = require( 'datatables.net' )();
require( 'datatables.net-buttons/js/buttons.colVis.js' )(); //# Column visibility
require( 'datatables.net-buttons/js/buttons.html5.js' )(); //# HTML 5 file export
require( 'datatables.net-buttons/js/buttons.print.js' )(); //# Print view butto
$(document).ready( function () {
var table = $('#table_id').DataTable({
"dom": '<"toolbar">Bfrtip',
"language": {
"paginate": {
"next": "Next"
}
},
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
})
$("div.toolbar").html('<input class="datePicker" type="month" name="" id="dated">');
dated.onchange = evt =>{
table.draw();
}
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var sdate = $('#dated').val().split('-')
var month = sdate[1]
var year = sdate[0]
console.log(data)
var date = data[1].split('-');
if ((isNaN(year) && isNaN(month)) ||
(isNaN(month) && year == date[0]) ||
(date[1] == month && isNaN(year)) ||
(date[1] == month && year == date[0])
) {
return true;
}
return false;
}
);
});
Solution 1:[1]
I have used tabulator instead of data table. tabulator working fine and easy to use.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Shafeeque OT |