Export PDF after doing some Javascript

Export PDF after doing some Javascript

karanitskaranits Posts: 9Questions: 0Answers: 0
edited July 2011 in TableTools
I want to be able to extend the PDF button. By this I dont mean just the button text but I want to do some javascript when the export to PDF button is clicked and then it gets exported. I tried using the following code

[code]
"aButtons": [
{
"sExtends": "pdf",
"fnClick": function (nButton, oConfig, oFlash) {
//do something EXRTA here before PDF is saved
},
"mColumns": "visible",
"sAction": "flash_pdf"
}
]
[/code]

But when PDF button is clicked, this code just does the "extra" work, but don't fire the export of PDF i.e PDF button is COMPLETELY overridden . So I was wondering, how to implement this?

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Since you are replacing the default fnClick with your own function - you need to replicate the fnClick code that TableTools uses: https://github.com/DataTables/TableTools/blob/master/media/js/TableTools.js#L2254

    Allan
This discussion has been closed.