mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-17 11:11:25 +00:00
fix(data-table): headers
should be reactive (#1075)
If `headers` is dynamically updated, clicking a sortable table header will sort the incorrect column. Instead of randomly generating an id and keeping track of it through context, we can simply use the required key in `headers` as the id.
This commit is contained in:
parent
cbecfd41e2
commit
a5f5550aa0
2 changed files with 2 additions and 7 deletions
|
@ -18,9 +18,7 @@
|
|||
import ArrowUp20 from "../icons/ArrowUp20.svelte";
|
||||
import ArrowsVertical20 from "../icons/ArrowsVertical20.svelte";
|
||||
|
||||
const { sortHeader, tableSortable, add } = getContext("DataTable");
|
||||
|
||||
add(id);
|
||||
const { sortHeader, tableSortable } = getContext("DataTable");
|
||||
|
||||
$: active = $sortHeader.id === id;
|
||||
// TODO: translate with id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue