mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
fix(data-table): cancelling selection should uncheck batch selection checkbox
This commit is contained in:
parent
a2b375f32e
commit
a0caa12a27
3 changed files with 148 additions and 136 deletions
|
@ -131,7 +131,9 @@
|
|||
tableSortable,
|
||||
batchSelectedIds,
|
||||
resetSelectedRowIds: () => {
|
||||
selectAll = false;
|
||||
selectedRowIds = [];
|
||||
if (refSelectAll) refSelectAll.checked = false;
|
||||
},
|
||||
add: (id) => {
|
||||
headerItems.update((_) => [..._, id]);
|
||||
|
@ -147,6 +149,8 @@
|
|||
);
|
||||
|
||||
let selectAll = false;
|
||||
let refSelectAll = null;
|
||||
|
||||
$: batchSelectedIds.set(selectedRowIds);
|
||||
$: indeterminate =
|
||||
selectedRowIds.length > 0 && selectedRowIds.length < rows.length;
|
||||
|
@ -221,6 +225,7 @@
|
|||
{#if batchSelection && !radio}
|
||||
<th scope="col" class:bx--table-column-checkbox="{true}">
|
||||
<InlineCheckbox
|
||||
bind:ref="{refSelectAll}"
|
||||
aria-label="Select all rows"
|
||||
checked="{selectAll}"
|
||||
indeterminate="{indeterminate}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue