Large Data and saving PDF (FnClick, FnComplete)
Large Data and saving PDF (FnClick, FnComplete)
axar
Posts: 4Questions: 0Answers: 0
Hi Everyone,
I was having issues when exporting large data tables into pdf (no notification, notices etc).
After some research, here is what i have done to achieve the same affect as Print and Rows Copied for PDF generating and saving.
[code]
var pdfMsgTimeout;
{
"sButtonClass" : "btn-primary",
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"fnClick": function( nButton, oConfig, flash ) {
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)
);
var nInfo = document.createElement( "div" );
nInfo.className = this.classes.print.info;
nInfo.innerHTML = 'Generating PDFPlease Wait...';
pdfMsgTimeout = document.body.appendChild( nInfo );
},
"fnComplete" : function () {
this.fnInfo( 'PDF Saved',3000);
document.body.removeChild( pdfMsgTimeout );
}
}
[/code]
The reason to not use fnInfo for fnClick, is so that the msg box stays until its removed from without fnComplete, ClearTimeout wasn't working too well by returning SetTimeOut variable from fnInfo.
This doesn't feel right however, it works. if anyone have any other suggestion let me know.
Thanks.
I was having issues when exporting large data tables into pdf (no notification, notices etc).
After some research, here is what i have done to achieve the same affect as Print and Rows Copied for PDF generating and saving.
[code]
var pdfMsgTimeout;
{
"sButtonClass" : "btn-primary",
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"fnClick": function( nButton, oConfig, flash ) {
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)
);
var nInfo = document.createElement( "div" );
nInfo.className = this.classes.print.info;
nInfo.innerHTML = 'Generating PDFPlease Wait...';
pdfMsgTimeout = document.body.appendChild( nInfo );
},
"fnComplete" : function () {
this.fnInfo( 'PDF Saved',3000);
document.body.removeChild( pdfMsgTimeout );
}
}
[/code]
The reason to not use fnInfo for fnClick, is so that the msg box stays until its removed from without fnComplete, ClearTimeout wasn't working too well by returning SetTimeOut variable from fnInfo.
This doesn't feel right however, it works. if anyone have any other suggestion let me know.
Thanks.
This discussion has been closed.