i want to make my export in data table showing picture, when i press print button its always not showing picture
enter image description here
i tried modified my print js button but it didnt work
Is there a problem with my datatable, or is there something wrong with my export? I searched on YouTube but the option to print that displays photos only uses fpdf
jQuery(document).ready(function () {
if ($('#kleper').length) {
$('#kleper').DataTable();
}
if ($('#data-tables').length) {
$setting = $('#dataTables-setting');
settings = {};
if ($setting.length > 0) {
settings = $.parseJSON($('#dataTables-setting').html());
}
addSettings = {
// "dom":"Bfrtip",
"buttons":[
{"extend":"copy"
,"text":"<i class='far fa-copy'></i> Copy"
,"className":"btn-light me-1"
},
{"extend":"excel"
, "title":"Outstanding Work Order"
, "text":"<i class='far fa-file-excel'></i> Excel"
, "exportOptions": {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19],
modifier: {selected: null}
}
, "className":"btn-light me-1"
},
{"extend":"pdf"
,"title":"Outstanding Work Order"
,"text":"<i class='far fa-file-pdf'></i> PDF"
, "exportOptions": {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19],
modifier: {selected: null}
}
,"className":"btn-light me-1"
},
{"extend":"csv"
,"title":"Outstanding Work Order"
,"text":"<i class='far fa-file-alt'></i> CSV"
, "exportOptions": {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19],
modifier: {selected: null}
}
,"className":"btn-light me-1"
},
{
extend: "print",
title: "Outstanding Work Order",
text: "<i class='fas fa-print'></i> Print",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,17, 19],
modifier: {selected: null}
},
className: "btn-light",
customize: function (win) {
$(win.document.body).find('img').each(function () {
// Setel lebar gambar agar sesuai dengan cetakan
$(this).css('width', '100%');
$(this).css('height', 'auto');
});
}
}
],
"lengthMenu": [10, 25, 50, 100], // Show entries options
"lengthChange": true, // Enable Show entries dropdown
}
// Merge settings
settings['lengthChange'] = false;
settings = { ...settings, ...addSettings };
var table = $('#data-tables').DataTable(settings);
table.buttons().container().appendTo('#data-tables_wrapper .col-md-6:eq(0)');
// No urut
table.on('order.dt search.dt', function () {
table.column(0, { search: 'applied', order: 'applied' }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1;
});
}).draw();
}
});
always not showing my picture
enter image description here