Export to PDF don't completed
Export to PDF don't completed
zeing
Posts: 9Questions: 3Answers: 0
I try to export Excel PDF and Print
Excel and Print i get file completely
but PDF
i can't get some field in table
data in table
Screen Shot 2560-10-09 at 16.30.09
my excel
but my pdf
i can't get appointment id and duration(min)
table_appointment = $('#table_appointment').DataTable({
"dom" : "<'columns is-margin-bottom-0'<'column a'B><'column b'><'column c'><'column is-2 'l><'column is-3'f>>" + "tr" + "<'columns'<'column'i><'column'p>>",
buttons: [
{
orientation: 'portrait',
"className": 'button is-primary',
pageSize: 'LEGAL',
extend: 'excelHtml5',
footer: true,
title: 'provider', //default filename
action: function(e, dt, button, config) {
var dataForm = convertDataFormToJSON('form-filter');
var providername = $( "#provider option:selected" ).text();
// console.log(moment.months(dataForm.month-1)
config.title = providername+" "+moment.monthsShort(dataForm.month-1).toUpperCase()+dataForm.year+" at "+formatDateTime(moment());
$.fn.dataTable.ext.buttons.excelHtml5.action(e, dt, button, config);
}
},
{
orientation: 'portrait',
pageSize: 'LEGAL',
extend: 'pdf',
"className": 'button is-secondary is-margin-left-10',
footer: true,
title: 'provider', //default filename
action: function(e, dt, button, config) {
var dataForm = convertDataFormToJSON('form-filter');
var providername = $( "#provider option:selected" ).text();
// console.log(moment.months(dataForm.month-1)
config.title = providername+" "+moment.monthsShort(dataForm.month-1).toUpperCase()+dataForm.year+" at "+formatDateTime(moment());
$.fn.dataTable.ext.buttons.pdfHtml5.action(e, dt, button, config);
},
customize: function (doc) {
doc.content[1].layout = "Borders";
}
},
{
orientation: 'portrait',
extend: 'print',
footer: true,
"className": 'button is-primary is-margin-left-10',
// message: '<p style="text-align:center;">' + searchCriteriaText + '</p>',
customize: function (win) {
$body = $(win.document.body);
$body.find('h1').css('text-align', 'center');
}
}
],
"ajax": function (data, callback, settings) {
var arrAppointment = [];
$.ajax(config.api, {
contentType: "application/x-www-form-urlencoded",
dataType: 'json',
type: 'POST',
data: {
cmd: "getAppointmentList",
data : JSON.stringify(dataInit)
},
success: function (data) { //Server respond
// console.log(data)
if (!data.error) {//Command SUCCESS
arrAppointment = data;
} else {
console.log('Handel error later !');
if (data.msg)
alertmesseage(data.msg);
else
alertmesseage('Error! Please Contact Admin!');
}
},
error: function (xhr, status, err) { // server doesn't respond
console.error('Contact backend error');
console.log(xhr, status, err);
alertmesseage('Please try again!');
},
complete: function () {
callback({data: arrAppointment})
changeFilter();
}
})
},
"columns": cols,
"scrollX": true,
"initComplete": function(){
},
"footerCallback": function ( row, data, start, end, display ) {
var api = this.api(), data;
// Remove the formatting to get integer data for summation
var intVal = function ( i ) {
return i == undefined || i == null ? 0 :typeof i === 'string' ?
i.replace(/[\$,]/g, '')*1 :
typeof i === 'number' ?
i : 0;
};
// Total over all pages
var total = api
.column( 5 )
.data()
.reduce( function (a, b) {
return parseInt(intVal(a) + intVal(b));
}, 0 );
// Total over this page
var pageTotal = api
.column( 5, { page: 'current'} )
.data()
.reduce( function (a, b) {
return parseInt(intVal(a) + intVal(b));
}, 0 );
// console.log(pageTotal)
// console.log(total)
// Update footer
$( api.column( 5 ).footer() ).html(
'฿'+addNumberComma(pageTotal)+' ( ฿'+ addNumberComma(total) +' total)'
);
}
});
May i help you? thank you
This discussion has been closed.
Answers
Thanks for your question. As noted in the forum rules, please post a link to a test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Allan
here you are
http://live.datatables.net/togomire/1/
You are using an old version of the software. If you use the latest versions it works no problem: http://live.datatables.net/togomire/4/edit .
Allan
i will try it , thank you