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}"
|
||||
style="{formatHeaderWidth(header)}"
|
||||
sortable="{sortable && header.sort !== false}"
|
||||
sortDirection="{sortDirection}"
|
||||
active="{sortKey !== null && sortKey === header.key}"
|
||||
sortDirection="{sortKey === header.key ? sortDirection : 'none'}"
|
||||
active="{sortKey === header.key}"
|
||||
on:click="{() => {
|
||||
dispatch('click', { header });
|
||||
|
||||
if (header.sort === false) {
|
||||
dispatch('click:header', { header });
|
||||
} else {
|
||||
sortDirection = sortDirectionMap[sortDirection];
|
||||
let currentSortDirection =
|
||||
sortKey === header.key ? sortDirection : 'none';
|
||||
sortDirection = sortDirectionMap[currentSortDirection];
|
||||
sortKey =
|
||||
sortDirection === 'none' ? null : $thKeys[header.key];
|
||||
dispatch('click:header', { header, sortDirection });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue