Skip to content

Commit

Permalink
Merge 8da0be7 into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ibmdotcom-bot authored Feb 9, 2024
2 parents c65ed61 + 8da0be7 commit a452e8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ class CDSTableHeaderCell extends FocusMixin(LitElement) {
/**
* `true` if the table has expandable rows
*/
@property({ type: Boolean, reflect: true, attribute: 'is-sortable' })
@property({ type: Boolean, reflect: true, attribute: 'expandable' })
isExpandable = false;

/**
* `true` if this table has selectable rows
*/
@property({ type: Boolean, reflect: true, attribute: 'is-sortable' })
@property({ type: Boolean, reflect: true, attribute: 'is-selectable' })
isSelectable = false;
/**
* `true` if this table header column should be sortable
Expand Down
21 changes: 14 additions & 7 deletions packages/carbon-web-components/src/components/data-table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,13 @@ class CDSTable extends HostListenerMixin(LitElement) {
const columns = [...this._tableHeaderRow.children];
const columnIndex = columns.indexOf(target);

columns.forEach(
(e) => e !== target && e.setAttribute('sort-direction', 'none')
);
columns.forEach((e) => {
if (e !== target && this.isSortable) {
e.setAttribute('sort-direction', 'none');
} else if (e.hasAttribute('is-sortable')) {
e.setAttribute('sort-direction', 'none');
}
});

this._handleSortAction(columnIndex, sortDirection);

Expand Down Expand Up @@ -825,10 +829,13 @@ class CDSTable extends HostListenerMixin(LitElement) {
}
});

columns.forEach(
(e, index) =>
index !== columnIndex && e.setAttribute('sort-direction', 'none')
);
columns.forEach((e, index) => {
if (index !== columnIndex && this.isSortable) {
e.setAttribute('sort-direction', 'none');
} else if (e.hasAttribute('is-sortable')) {
e.setAttribute('sort-direction', 'none');
}
});
this._handleSortAction(columnIndex, sortDirection);
}

Expand Down

0 comments on commit a452e8d

Please sign in to comment.