mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
hotfix(data-table): column sort direction order should be independent (#1342)
Fixes #1341
This commit is contained in:
parent
566d64c970
commit
e56ee83dc4
1 changed files with 5 additions and 3 deletions
|
@ -344,15 +344,17 @@
|
||||||
id="{header.key}"
|
id="{header.key}"
|
||||||
style="{formatHeaderWidth(header)}"
|
style="{formatHeaderWidth(header)}"
|
||||||
sortable="{sortable && header.sort !== false}"
|
sortable="{sortable && header.sort !== false}"
|
||||||
sortDirection="{sortDirection}"
|
sortDirection="{sortKey === header.key ? sortDirection : 'none'}"
|
||||||
active="{sortKey !== null && sortKey === header.key}"
|
active="{sortKey === header.key}"
|
||||||
on:click="{() => {
|
on:click="{() => {
|
||||||
dispatch('click', { header });
|
dispatch('click', { header });
|
||||||
|
|
||||||
if (header.sort === false) {
|
if (header.sort === false) {
|
||||||
dispatch('click:header', { header });
|
dispatch('click:header', { header });
|
||||||
} else {
|
} else {
|
||||||
sortDirection = sortDirectionMap[sortDirection];
|
let currentSortDirection =
|
||||||
|
sortKey === header.key ? sortDirection : 'none';
|
||||||
|
sortDirection = sortDirectionMap[currentSortDirection];
|
||||||
sortKey =
|
sortKey =
|
||||||
sortDirection === 'none' ? null : $thKeys[header.key];
|
sortDirection === 'none' ? null : $thKeys[header.key];
|
||||||
dispatch('click:header', { header, sortDirection });
|
dispatch('click:header', { header, sortDirection });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue