How to use Pace or processing bar when export as excel?
How to use Pace or processing bar when export as excel?
shi feng
Posts: 1Questions: 0Answers: 0
I'm using server side for datatables and using ajax for exporting excel, and I try to use Pace when I export excel, but it seems when the excel was downloaded, the Pace.start() begin executed.
If I want to execute Pace.start() after click export button, what should I do?
The following are javascript for buttons:
buttons : [
{
extend : 'excelHtml5',
className : 'btn default',
title : '{{reportlabel.labelname}}',
exportOptions: {
columns: {{exportcolumns}}
},
customizeData: function ( data ) {
/* if(data.body.length <= pagesize){
return data;
} */
Pace.start();
$.ajax({
url: "/report/{{rtype}}/{{reportid}}/exportexcel",
data: excelparameter,
async: false,
success: function(returnData) {
data.body = returnData;
},
error:function (xhr, ajaxOptions, thrownError){
console.log("export excel error")
}
});
Pace.stop();
return data;
}
}
]
This discussion has been closed.
Replies
I would suggest using a custom button type instead of using the
excelHtml5
button type. That way to can control it a little easier - specifically you'll need to call the action method of theexcelHtml5
button type and then yourPace.stop()
method once that has completed. The last example in thebuttons.buttons.action
documentation shows how that might be done.Allan