Skip to content

Commit

Permalink
Fix unhiding default hidden columns (#21354)
Browse files Browse the repository at this point in the history
* Fix unhiding default hidden columns

* Update dialog-data-table-settings.ts
  • Loading branch information
bramkragten authored Jul 10, 2024
1 parent daa3678 commit cd4937b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/data-table/dialog-data-table-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export class DialogDataTableSettings extends LitElement {
.filter(([_key, col]) => col.defaultHidden)
.map(([key]) => key)),
];

if (wasHidden && hidden.includes(column)) {
hidden.splice(hidden.indexOf(column), 1);
} else if (!wasHidden) {
Expand Down Expand Up @@ -235,14 +236,14 @@ export class DialogDataTableSettings extends LitElement {
}

columns.forEach((col) => {
if (!newOrder.includes(col.key)) {
if (col.key !== column && !newOrder.includes(col.key)) {
if (col.moveable === false) {
newOrder.unshift(col.key);
} else {
newOrder.splice(lastMoveable + 1, 0, col.key);
}

if (col.defaultHidden) {
if (col.defaultHidden && !hidden.includes(col.key)) {
hidden.push(col.key);
}
}
Expand Down

0 comments on commit cd4937b

Please sign in to comment.