Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove useless code from forceFillColumnWidths #116

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions projects/ngx-datatable/src/lib/utils/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,6 @@ export function forceFillColumnWidths(
.slice(startIdx + 1, allColumns.length)
.filter(c => c.canAutoResize !== false);

for (const column of columnsToResize) {
if (!column.$$oldWidth) {
column.$$oldWidth = column.width;
}
}

let additionWidthPerColumn = 0;
let exceedsWindow = false;
let contentWidth = getContentWidth(allColumns, defaultColWidth);
Expand All @@ -155,7 +149,7 @@ export function forceFillColumnWidths(
for (const column of columnsToResize) {
// don't bleed if the initialRemainingWidth is same as verticalScrollWidth
if (exceedsWindow && allowBleed && initialRemainingWidth !== -1 * verticalScrollWidth) {
column.width = column.$$oldWidth || column.width || defaultColWidth;
column.width = column.width || defaultColWidth;
} else {
const newSize = (column.width || defaultColWidth) + additionWidthPerColumn;

Expand All @@ -177,11 +171,6 @@ export function forceFillColumnWidths(
remainingWidth = expectedWidth - contentWidth;
removeProcessedColumns(columnsToResize, columnsProcessed);
} while (remainingWidth > remainingWidthLimit && columnsToResize.length !== 0);

// reset so we don't have stale values
for (const column of columnsToResize) {
column.$$oldWidth = 0;
}
}

/**
Expand Down