mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
Use store $ assignment to fix batch selection
Without the `=` sign, the reactivity chain were broken. Using an assignment by prefixing the store with a `$` fixes this. https://svelte.dev/docs#component-format-script-4-prefix-stores-with-$-to-access-their-values
This commit is contained in:
parent
c2568ec5d4
commit
962202ccd6
1 changed files with 8 additions and 10 deletions
|
@ -195,16 +195,14 @@
|
||||||
$: if (radio || batchSelection) selectable = true;
|
$: if (radio || batchSelection) selectable = true;
|
||||||
$: tableSortable.set(sortable);
|
$: tableSortable.set(sortable);
|
||||||
$: headerKeys = headers.map(({ key }) => key);
|
$: headerKeys = headers.map(({ key }) => key);
|
||||||
$: tableRows.set(
|
$: $tableRows = rows.map((row) => ({
|
||||||
rows.map((row) => ({
|
|
||||||
...row,
|
...row,
|
||||||
cells: headerKeys.map((key, index) => ({
|
cells: headerKeys.map((key, index) => ({
|
||||||
key,
|
key,
|
||||||
value: resolvePath(row, key),
|
value: resolvePath(row, key),
|
||||||
display: headers[index].display,
|
display: headers[index].display,
|
||||||
})),
|
})),
|
||||||
}))
|
}));
|
||||||
);
|
|
||||||
$: sortedRows = [...$tableRows];
|
$: sortedRows = [...$tableRows];
|
||||||
$: ascending = $sortHeader.sortDirection === "ascending";
|
$: ascending = $sortHeader.sortDirection === "ascending";
|
||||||
$: sortKey = $sortHeader.key;
|
$: sortKey = $sortHeader.key;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue