WIP: Download wait message. datatables

This commit is contained in:
Calvo 2022-12-02 13:12:58 +01:00
parent d525cb594c
commit e0afcd0b85
3 changed files with 18 additions and 34 deletions

View File

@ -3542,6 +3542,8 @@ function ui_print_datatable(array $parameters)
fieldSeparator: "'.$config['csv_divider'].'",
action: function ( e, dt, node, config ) {
blockResubmit(node);
// Call the default csvHtml5 action method to create the CSV file
$.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, node, config);
},
exportOptions : {
modifier : {
@ -3674,6 +3676,16 @@ function ui_print_datatable(array $parameters)
$js .= '$(".datatables_thead_tr").css("height", 0);';
}
if (isset($parameters['csv']) === true) {
$js."'$('#".$table_id."').on( 'buttons-processing', function ( e, indicator ) {
if ( indicator ) {
console.log('a');
}
else {
console.log('b');
}";
}
$js .= '});';
$js .= '</script>';

File diff suppressed because one or more lines are too long

View File

@ -784,12 +784,11 @@ function setCursor(buttonStyle, button) {
button.css("cursor", buttonStyle);
}
function setToken() {
var downloadToken = new Date().getTime();
document.cookie =
"downloadToken" + "=" + downloadToken + ";" + "-1" + ";path=/";
function setToken(tokenName, token) {
token = typeof token !== "undefined" ? token : new Date().getTime();
document.cookie = tokenName + "=" + token + ";" + "-1" + ";path=/";
return downloadToken;
return token;
}
var downloadTimer;
@ -797,7 +796,7 @@ var attempts = 30;
// Prevents double-submits by waiting for a cookie from the server.
function blockResubmit(button) {
var downloadToken = setToken();
var downloadToken = setToken("downloadToken");
setCursor("wait", button);
// Disable butoon to prevent clicking until download is ready.