Skip to content

Commit

Permalink
fix: Set width of columns without mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
Domino987 committed Jun 1, 2021
1 parent 390fb59 commit 4e08c89
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* @mbrn
* @domino051
* @oze4
24 changes: 12 additions & 12 deletions src/utils/data-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,6 @@ export default class DataManager {
}

setColumns(columns) {
const undefinedWidthColumns = columns.filter((c) => {
if (c.hidden) {
// Hidden column
return false;
}
if (c.columnDef && c.columnDef.tableData && c.columnDef.tableData.width) {
// tableData.width already calculated
return false;
}
// Calculate width if no value provided
return c.width === undefined;
});
let usedWidth = ['0px'];

this.columns = columns.map((columnDef, index) => {
Expand Down Expand Up @@ -105,6 +93,18 @@ export default class DataManager {

return { ...columnDef, tableData };
});
const undefinedWidthColumns = this.columns.filter((c) => {
if (c.hidden) {
// Hidden column
return false;
}
if (c.columnDef && c.columnDef.tableData && c.columnDef.tableData.width) {
// tableData.width already calculated
return false;
}
// Calculate width if no value provided
return c.width === undefined;
});

usedWidth = '(' + usedWidth.join(' + ') + ')';
undefinedWidthColumns.forEach((columnDef) => {
Expand Down

0 comments on commit 4e08c89

Please sign in to comment.