Set PDF filename on click of the PDF TableTools button?
Set PDF filename on click of the PDF TableTools button?
Nympheasi
Posts: 24Questions: 0Answers: 0
Hi,
I would like to know if it's possible to set the pdf filename title onclick of the pdf TableTools button (the sFileName parameter)?
I would like to use dynamic filename.
Thanks!
I would like to know if it's possible to set the pdf filename title onclick of the pdf TableTools button (the sFileName parameter)?
I would like to use dynamic filename.
Thanks!
This discussion has been closed.
Replies
[code]
"fnClick": function( nButton, oConfig, flash ) {
fileName = setFileName()+".pdf";
flash.setFileName( fileName );
this.fnSetText( flash,
"title:"+ this.fnGetTitle(oConfig) +"\n"+
"message:"+ oConfig.sPdfMessage +"\n"+
"colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+
"orientation:"+ oConfig.sPdfOrientation +"\n"+
"size:"+ oConfig.sPdfSize +"\n"+
"--/TableToolsOpts--\n" +
this.fnGetTableData(oConfig)
);
}
[/code]
I set the filename I want using an external function I wrote called setfileName.
[code]
function setFileName(){
var market = $("#market option:selected").text();
var startDate = $("#from").val();
var endDate = $("#to").val();
var oSettings = oTable.fnSettings();
var fileName = market+"_"+startDate+"_to_"+endDate;
return fileName;
}
[/code]
So, using the fnClick function, I set my filename (fileName = setFileName()+".pdf";) and then tell the flash the sFileName (flash.setFileName( fileName ); )
And that's it!