Skip to content

Commit b9878e2

Browse files
committed
Added toggle all button on attribute column
1 parent 1d33f53 commit b9878e2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/lib/components/v2/projects/datasets/DatasetImagesTable.svelte

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,22 @@
436436
throw await getAlertErrorFromResponse(response);
437437
}
438438
}
439+
440+
/**
441+
* @param {string} attributeKey
442+
*/
443+
function toggleAll(attributeKey) {
444+
const selector = attributesSelectors[attributeKey];
445+
const values = imagePage.attributes[attributeKey];
446+
if (!selector || !values) {
447+
return;
448+
}
449+
if (selector.getSelected().length === values.length) {
450+
selector.setSelected([]);
451+
} else {
452+
selector.setSelected(values.map((v) => v.toString()));
453+
}
454+
}
439455
</script>
440456
441457
{#if !showTable}
@@ -476,6 +492,13 @@
476492
<label for="attribute-{getIdFromValue(attributeKey)}">
477493
{attributeKey}
478494
</label>
495+
<button
496+
class="ps-0 btn btn-link"
497+
on:click={() => toggleAll(attributeKey)}
498+
title="Toggle all"
499+
>
500+
<i class="bi bi-check-all" />
501+
</button>
479502
</th>
480503
{/each}
481504
{#each imagePage.types as typeKey}

0 commit comments

Comments
 (0)