I'm trying to use the methods to capture when the file (pdf, xls, csv) finishes downloading, in the documentation of the tabulator library there are the methods, onDownloadComplete and downloadReady, but they don't work, how should I use them? In my use case I need that instead of downloading the file it is sent in a form to the backend. Thank you
Tabulator, download file complete
Answers approved by surveyjs Support
created 2 years ago
(modified 2 years ago)
Hello Luis,
According to the Tabulator documentation (Download Callbacks), you can use the downloadReady
callback to intercept the download file data before a file is downloaded.
In SurveyJS Dashboard, you can access this callback using the tabulatorTables object instance. Note that this object is available after a render
function of a dashboard is called.
JavaScriptvar visPanel = new SurveyAnalyticsTabulator.Tabulator(
survey,
dataFromServer
);
visPanel.render("surveyDashboardContainer");
visPanel.tabulatorTables.options.downloadReady = function(fileContents, blob){
//fileContents - the unencoded contents of the file
//blob - the blob object for the download
//custom action to send blob to server could be included here
return blob;
}
});
For the record: if you need to perform changes to the table data before it is parsed into the download file, use the onDownloadCallback function.
I hope this information helps. Please let me know if you have any question or require further assistance.