Export Filter Table Button Serverside
Export Filter Table Button Serverside
gwiqu
Posts: 8Questions: 4Answers: 1
How would i go about creating a button that will call the server to send the entire filtered table to the user as an excel file?
i tried using a custom button to call the specific url for downloading but even though the server sends back a file, it doesnt get downloaded to my computer? im using Flask return Response
Answers
Why would you call the server? If it is just about the table you can use the built-in Excel export buttons as well without having the need to call the server.
But anyway: Here is something that creates a downloadable file on the server and downloads it to the client on button click.
I have a button that downloads a lot of documents in a zip file to the client. This line does the actual downloading:
"data.zip" being the web-path of the file to be downloaded (in my case a .zip file and in your case .xlsx).
That is basically it. I save the created file on the server so that it can be downloaded. Afterwards I delete this temporary file because I don't want to keep it on the server. The timeout I use is more or less arbitrary - but there is no hurry to get the temporary file deleted.
Here is more on how to send an entire data table to the server:
https://datatables.net/forums/discussion/comment/168298/#Comment_168298