mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(data-table): rows
should be reactive (#1255)
This commit is contained in:
parent
c2568ec5d4
commit
43e2986434
1 changed files with 8 additions and 10 deletions
|
@ -195,16 +195,14 @@
|
|||
$: if (radio || batchSelection) selectable = true;
|
||||
$: tableSortable.set(sortable);
|
||||
$: headerKeys = headers.map(({ key }) => key);
|
||||
$: tableRows.set(
|
||||
rows.map((row) => ({
|
||||
...row,
|
||||
cells: headerKeys.map((key, index) => ({
|
||||
key,
|
||||
value: resolvePath(row, key),
|
||||
display: headers[index].display,
|
||||
})),
|
||||
}))
|
||||
);
|
||||
$: $tableRows = rows.map((row) => ({
|
||||
...row,
|
||||
cells: headerKeys.map((key, index) => ({
|
||||
key,
|
||||
value: resolvePath(row, key),
|
||||
display: headers[index].display,
|
||||
})),
|
||||
}));
|
||||
$: sortedRows = [...$tableRows];
|
||||
$: ascending = $sortHeader.sortDirection === "ascending";
|
||||
$: sortKey = $sortHeader.key;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue