Can't change "Title" of a Excel, PDF exported file.
Can't change "Title" of a Excel, PDF exported file.
I'm trying to export a excel, PDF, SVG file of my table and it's working fine, but I need to change the name of file to the value selected on SearchBuilder using searchBuilder.getDetails().criteria; The code I built returns the value if I try to output in Console, but doesnt work in the file name... Follow my code:
https://codepen.io/Jo-o-Anzolim/pen/XWBjpjv
PS: The code I'm talking about is the last lines of . I think its not working because its not inside in the function of table:
$(document).ready(function() {
var table = $('#datatable').DataTable...
Thanks in advance!
This question has an accepted answers - jump to answer
Answers
If I'm reading the code correctly, it is just setting the
valorExportar
variable when the table is loaded. AlsovalorExportar
is undefined when it is used for the button.You are better to use a function for something like this:
That way it will be executed when it is needed.
I don't see a way to save my changes on that pen, but that's basically it.
Allan
Thank you very much, Allan! It worked well.