Is it possible to check a if statement before download pdf?

Is it possible to check a if statement before download pdf?

layla0323layla0323 Posts: 2Questions: 2Answers: 0

Hi,
I create a pdf button:
"buttons": [
{
text:'<i class="fa fa-file-pdf-o"> PDF</i>',
titleAttr: 'PDF',
extend: 'pdfHtml5',
download: 'download',
filename: 'Individual'
}
]

I just want to know that how to check the "iTotalDisplayRecords" first, then download.
For example, if the iTotalDisplayRecords is above 500, when you click on the PDF button it will pop up a error alert. If not, then download.
Thanks!

Answers

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    You would need to use a custom button that would performt he logic check. If it passes it would call the PDF export button's action function ($.fn.dataTable.buttons.pdfHtml5.action - passing in the same arguments as to your custom button).

    Allan

This discussion has been closed.