Has anyone looked into lazy/aysnc loading of the pdf export function?

Has anyone looked into lazy/aysnc loading of the pdf export function?

CharleyCharley Posts: 66Questions: 17Answers: 0

The pdfmake.min.js is over 1mb by itself.

Since generating a pdf of a table isn't something that I expect to happen constantly, I wonder if there's a way to
1. load the page without pdfmake, but still force buttons to generate a pdf export button when instantiating a datatable (without that loaded, that buttonconfig gets ignored)
2. when that pdf export button gets clicked; check to see if pdfmake has been loaded,
3. if it has been loaded, go ahead and generate the pdf using the pdf export functionality.
4. if not, go fetch pdfmake and after fetching pdfmake, go ahead and call the function to generate a pdf of the table

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Yeah - the PDF file is massive which is why I've ended up pointed to the external CDN for it.

    Currently no - the pdf export button doesn't do lazy loading of the file - but it would be quite possible to create a pdfLazyLoad custom button that would do exactly that (custom button documentation).

    Allan

This discussion has been closed.