fix hacked printing to wait for dialog.hide() instead of using a timeout and also reduce waiting for the browser to render all rows from 10 to 3ms/row

This commit is contained in:
ralf 2024-08-26 19:14:08 +02:00
parent 3eb3a87cf2
commit 9495dd48b9

View File

@ -2994,7 +2994,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
{ {
this.set_columns(jQuery.extend([], this.egw().preference(pref, app))); this.set_columns(jQuery.extend([], this.egw().preference(pref, app)));
} }
let printDialog;
const callback = function(button, value) const callback = function(button, value)
{ {
if(button === Et2Dialog.CANCEL_BUTTON) if(button === Et2Dialog.CANCEL_BUTTON)
@ -3083,7 +3083,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
egw.lang('Loading'), egw.lang('please wait...'), {}, [ egw.lang('Loading'), egw.lang('please wait...'), {}, [
{ {
"button_id": Et2Dialog.CANCEL_BUTTON, "button_id": Et2Dialog.CANCEL_BUTTON,
label: 'cancel', label: egw.lang('Cancel'),
id: 'dialog[cancel]', id: 'dialog[cancel]',
image: 'cancel' image: 'cancel'
} }
@ -3140,15 +3140,10 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
const promises = nodeListArray.map(node => node.updateComplete); const promises = nodeListArray.map(node => node.updateComplete);
Promise.all(promises).finally(() => Promise.all(promises).finally(() =>
{ {
dialog.close();
// Should be OK to print now // Should be OK to print now
dialog.updateComplete.then(() => dialog.close().then(() => resolve());
{
window.setTimeout(() => resolve(), 500);
});
}); });
}, 10 * fetchedCount); }, 3 * fetchedCount);
} }
}, ctx); }, ctx);
@ -3172,10 +3167,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
// No scrollbar in print view // No scrollbar in print view
jQuery('.egwGridView_scrollarea', this.div).css('overflow-y', 'hidden'); jQuery('.egwGridView_scrollarea', this.div).css('overflow-y', 'hidden');
// Give dialog a chance to close, or it will be in the print // Give dialog a chance to close, or it will be in the print
window.setTimeout(function() printDialog.close().then(() => resolve());
{
resolve();
}, 200);
} }
}.bind(this); }.bind(this);
const value = { const value = {
@ -3193,7 +3185,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
} }
} }
}; };
await this._create_print_dialog.call(this, value, callback).updateComplete; await (printDialog=this._create_print_dialog.call(this, value, callback)).updateComplete;
}); });
} }