|
|
@@ -40,12 +40,14 @@ class TableRenderer {
|
|
|
this.columnHeaderCount = 0;
|
|
|
this.fixedRowsTop = 0;
|
|
|
this.fixedRowsBottom = 0;
|
|
|
+ this.workspaceWidth = this.wot.wtViewport.getWorkspaceWidth();
|
|
|
+ this.innerHeight = innerHeight(this.instance.wtTable.TBODY) - 1;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
- render() {
|
|
|
+ render(reCalcWidth = true) {
|
|
|
if (!this.wtTable.isWorkingOnClone()) {
|
|
|
const skipRender = {};
|
|
|
this.wot.getSetting('beforeDraw', true, skipRender);
|
|
|
@@ -89,11 +91,12 @@ class TableRenderer {
|
|
|
this.renderRows(totalRows, rowsToRender, columnsToRender);
|
|
|
|
|
|
if (!this.wtTable.isWorkingOnClone()) {
|
|
|
- workspaceWidth = this.wot.wtViewport.getWorkspaceWidth();
|
|
|
+ if (reCalcWidth === true) this.workspaceWidth = this.wot.wtViewport.getWorkspaceWidth();
|
|
|
+ workspaceWidth = this.workspaceWidth;
|
|
|
this.wot.wtViewport.containerWidth = null;
|
|
|
}
|
|
|
|
|
|
- this.adjustColumnWidths(columnsToRender);
|
|
|
+ if (reCalcWidth === true) this.adjustColumnWidths(columnsToRender);
|
|
|
this.markOversizedColumnHeaders();
|
|
|
this.adjustColumnHeaderHeights();
|
|
|
}
|
|
|
@@ -104,23 +107,26 @@ class TableRenderer {
|
|
|
this.removeRedundantRows(rowsToRender);
|
|
|
|
|
|
if (!this.wtTable.isWorkingOnClone() || this.wot.isOverlayName(Overlay.CLONE_BOTTOM)) {
|
|
|
- this.markOversizedRows();
|
|
|
+ this.markOversizedRows(reCalcWidth);
|
|
|
}
|
|
|
if (!this.wtTable.isWorkingOnClone()) {
|
|
|
- this.wot.wtViewport.createVisibleCalculators();
|
|
|
- this.wot.wtOverlays.refresh(false);
|
|
|
+ if (reCalcWidth === true) this.wot.wtViewport.createVisibleCalculators();
|
|
|
+ this.wot.wtOverlays.refresh(false, reCalcWidth);
|
|
|
|
|
|
this.wot.wtOverlays.applyToDOM();
|
|
|
|
|
|
- const hiderWidth = outerWidth(this.wtTable.hider);
|
|
|
- const tableWidth = outerWidth(this.wtTable.TABLE);
|
|
|
+ if (reCalcWidth === true) {
|
|
|
|
|
|
- if (hiderWidth !== 0 && (tableWidth !== hiderWidth)) {
|
|
|
- // Recalculate the column widths, if width changes made in the overlays removed the scrollbar, thus changing the viewport width.
|
|
|
- this.adjustColumnWidths(columnsToRender);
|
|
|
+ const hiderWidth = outerWidth(this.wtTable.hider);
|
|
|
+ const tableWidth = outerWidth(this.wtTable.TABLE);
|
|
|
+
|
|
|
+ if (hiderWidth !== 0 && (tableWidth !== hiderWidth)) {
|
|
|
+ // Recalculate the column widths, if width changes made in the overlays removed the scrollbar, thus changing the viewport width.
|
|
|
+ this.adjustColumnWidths(columnsToRender);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (workspaceWidth !== this.wot.wtViewport.getWorkspaceWidth()) {
|
|
|
+ if (reCalcWidth === true && workspaceWidth !== this.wot.wtViewport.getWorkspaceWidth()) {
|
|
|
// workspace width changed though to shown/hidden vertical scrollbar. Let's reapply stretching
|
|
|
this.wot.wtViewport.containerWidth = null;
|
|
|
|
|
|
@@ -238,13 +244,14 @@ class TableRenderer {
|
|
|
/**
|
|
|
* Check if any of the rendered rows is higher than expected, and if so, cache them
|
|
|
*/
|
|
|
- markOversizedRows() {
|
|
|
+ markOversizedRows(reCalcWidth = true) {
|
|
|
if (this.wot.getSetting('externalRowCalculator')) {
|
|
|
return;
|
|
|
}
|
|
|
let rowCount = this.instance.wtTable.TBODY.childNodes.length;
|
|
|
const expectedTableHeight = rowCount * this.instance.wtSettings.settings.defaultRowHeight;
|
|
|
- const actualTableHeight = innerHeight(this.instance.wtTable.TBODY) - 1;
|
|
|
+ if (reCalcWidth === true) this.innerHeight = innerHeight(this.instance.wtTable.TBODY) - 1;
|
|
|
+ const actualTableHeight = this.innerHeight;
|
|
|
let previousRowHeight;
|
|
|
let rowInnerHeight;
|
|
|
let sourceRowIndex;
|