can I insert a query to sql server inside the htmlpdf5?
can I insert a query to sql server inside the htmlpdf5?
this is my code, but I need to show the values of the table separately, the table generates me the assistances and absences altogether, but I need to generate the pdf separating them, is it possible to make an sql query inside the pdfhtml5 button?
extend: 'pdfHtml5',
text: '<i class="fa fa-file-pdf-o" style="font-size:48px;color:red"></i>PDF',
title:'Informe de asistencia',
titleAttr: 'PDF',
className: 'btn btn-app export pdf',
exportOptions: {
columns: [ 0, 3 ]
},
customize:function(doc) {
doc.styles.title = {
color: '#4c8aa0',
fontSize: '30',
alignment: 'center'
}
doc.styles['td:nth-child(2)'] = {
width: '100px',
'max-width': '100px'
},
doc.styles.tableHeader = {
fillColor:'#4c8aa0',
color:'white',
alignment:'center'
},
doc.content[1].margin = [ 100, 0, 100, 0 ]
}
},
This question has accepted answers - jump to:
Answers
It might be problematic to use an Ajax request inside the export buttons as Ajax is an async process.
Does your Datatable contain all the data (assistances and absences ) that you want to export? If so you might be able to use a Custom Button with the
buttons.buttons.action
option to generate theassistances
data, export it then generate theabsences
and export it with one button. The last example in the docs briefly show how to do this.Kevin
yes, in a column there are the attendances and in that same the absences. Where can I find documentation?
Thank you !
Click the links:
Custom Button
buttons.buttons.action
or https://datatables.net/reference/option/buttons.buttons.actionKevin