Fix calculation of table widths for print view
This commit is contained in:
parent
56e32d11b3
commit
339e1496a7
@ -594,7 +594,7 @@ function printResult() {
|
|||||||
|
|
||||||
// Add stylesheets
|
// Add stylesheets
|
||||||
let numToLoad = 0;
|
let numToLoad = 0;
|
||||||
let numLoaded = 0;
|
let numLoaded = -1;
|
||||||
|
|
||||||
function onLoadStylesheet() {
|
function onLoadStylesheet() {
|
||||||
numLoaded++;
|
numLoaded++;
|
||||||
@ -676,7 +676,7 @@ function printResult() {
|
|||||||
return tdsAdded;
|
return tdsAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyTableColumns(startCol) {
|
async function copyTableColumns(startCol) {
|
||||||
// Add table
|
// Add table
|
||||||
let elTable2 = wprint.document.createElement('table');
|
let elTable2 = wprint.document.createElement('table');
|
||||||
elTable2.className = 'result';
|
elTable2.className = 'result';
|
||||||
@ -701,6 +701,9 @@ function printResult() {
|
|||||||
for (let c = startCol; c < rows[0].length + 1; c++) { // +1 to account for final status column
|
for (let c = startCol; c < rows[0].length + 1; c++) { // +1 to account for final status column
|
||||||
let tdsAdded = copyColumn(c, elTrs2);
|
let tdsAdded = copyColumn(c, elTrs2);
|
||||||
|
|
||||||
|
// Nasty hack: DOM can take a while to update clientWidth
|
||||||
|
await new Promise(wprint.requestAnimationFrame);
|
||||||
|
|
||||||
// Check if overflowed
|
// Check if overflowed
|
||||||
if (elTable2.clientWidth > printableWidth) {
|
if (elTable2.clientWidth > printableWidth) {
|
||||||
for (let elTd2 of tdsAdded) {
|
for (let elTd2 of tdsAdded) {
|
||||||
@ -712,11 +715,14 @@ function printResult() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copyTableColumns(1);
|
copyTableColumns(1).then(function() {
|
||||||
|
// Copy result logs2
|
||||||
// Copy result logs2
|
divResultLogs1 = document.getElementById('resultLogs2');
|
||||||
divResultLogs1 = document.getElementById('resultLogs2');
|
divResultLogs2 = wprint.document.createElement('div');
|
||||||
divResultLogs2 = wprint.document.createElement('div');
|
divResultLogs2.innerHTML = divResultLogs1.innerHTML;
|
||||||
divResultLogs2.innerHTML = divResultLogs1.innerHTML;
|
elContainer.appendChild(divResultLogs2);
|
||||||
elContainer.appendChild(divResultLogs2);
|
|
||||||
|
// Trigger print when ready
|
||||||
|
onLoadStylesheet();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user