Show a loading message when downloading file
Show a loading message when downloading file
tihg7947
Posts: 9Questions: 0Answers: 0
Hello, I'm using the jQuery DataTables plugin to print many records to an Excel file. There are cases where users want to save a large amount of records and the downloading can take a few minutes or more. I was wondering if there was a way to let the user know the file is still downloading so they don't rage quit the screen. Is there something similar to bProcessing but for downloads? Any help or guidance is greatly appreciated.
[code]
TableTools.BUTTONS.download = {
"sAction": "text",
"sTag": "default",
"sFieldBoundary": "",
"sFieldSeperator": "\t",
"sNewLine": "
",
"sToolTip": "",
"sButtonClass": "DTTT_button_text",
"sButtonClassHover": "DTTT_button_text_hover",
"sButtonText": "Download",
"mColumns": "all",
"bHeader": true,
"bFooter": true,
"sDiv": "",
"fnMouseover": null,
"fnMouseout": null,
"fnClick": function( nButton, oConfig ) {
var oParams = this.s.dt.oApi._fnAjaxParameters( this.s.dt );
var iframe = document.createElement('iframe');
iframe.style.height = "0px";
iframe.style.width = "0px";
iframe.src = oConfig.sUrl+"?"+$.param(oParams);
document.body.appendChild( iframe );
},
"fnSelect": null,
"fnComplete": null,
"fnInit": null
};
$(document).ready(function () {
$('#Personnel').dataTable({
"bLengthChange": false,
"iDisplayLength": <%=UserTableSize %>,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "server_side.asp",
"aaSorting": [[ 1, "asc" ]],
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
"copy",
{
"sExtends": "download",
"sButtonText": "Excel",
"sUrl": "generate_csv.asp"
},
"print" ],
"sSwfPath": "../swf/copy_cvs_xls_pdf.swf"
}
} );
});
[/code]
[code]
TableTools.BUTTONS.download = {
"sAction": "text",
"sTag": "default",
"sFieldBoundary": "",
"sFieldSeperator": "\t",
"sNewLine": "
",
"sToolTip": "",
"sButtonClass": "DTTT_button_text",
"sButtonClassHover": "DTTT_button_text_hover",
"sButtonText": "Download",
"mColumns": "all",
"bHeader": true,
"bFooter": true,
"sDiv": "",
"fnMouseover": null,
"fnMouseout": null,
"fnClick": function( nButton, oConfig ) {
var oParams = this.s.dt.oApi._fnAjaxParameters( this.s.dt );
var iframe = document.createElement('iframe');
iframe.style.height = "0px";
iframe.style.width = "0px";
iframe.src = oConfig.sUrl+"?"+$.param(oParams);
document.body.appendChild( iframe );
},
"fnSelect": null,
"fnComplete": null,
"fnInit": null
};
$(document).ready(function () {
$('#Personnel').dataTable({
"bLengthChange": false,
"iDisplayLength": <%=UserTableSize %>,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "server_side.asp",
"aaSorting": [[ 1, "asc" ]],
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
"copy",
{
"sExtends": "download",
"sButtonText": "Excel",
"sUrl": "generate_csv.asp"
},
"print" ],
"sSwfPath": "../swf/copy_cvs_xls_pdf.swf"
}
} );
});
[/code]
This discussion has been closed.