Add custom columns to PDF/Export/Print?
Add custom columns to PDF/Export/Print?
resqonline
Posts: 58Questions: 14Answers: 0
Is it possible to add columns without any special value from the datatable to an export/pdf/print file?
So for example: When exporting all confirmed participants from a list, I want the columns to be:
row index number (how can I add that?), name (from table), some other column from table, additional column with custom header text, second additional column
This question has an accepted answers - jump to answer
Answers
Do you mean for a column that doesn't exist in the DataTable? If so, you would need to use the
customizeData
callback for each button type to modify the data retrieved for the button and add the extra column (a simple loop and anunshift
to add an index should do it).Allan
Oh dear! I might be easier off with doing an ajax call and passing it to a PDF making function I already use Otherwise I would spent hours learning how to customize a not so nice looking PDF with PDF make... the client wouldn't like that.
If you already have a PDF generator, I'd agree - go with that.
I've actually been strongly thinking about dropping pdfmake entirely and just asking users to do "Print to PDF" in their browsers...
Allan
I've now managed to get a custom export PDF by using an ajax call to get the data and columns I want to display and simply edit the whole PDF process on the go:
Sorry - not clear if that is a question or not? It looks like you've got a way to make Ajax retrieved data to work with pdfmake there.
Allan