web/elements: fix unchecking all elements not unchecking select-all

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-08-14 21:38:05 +02:00
parent 47070261b0
commit 769a3424dc
1 changed files with 13 additions and 0 deletions

View File

@ -233,6 +233,18 @@ export abstract class Table<T> extends LitElement {
this.selectedElements.splice(index, 1);
}
this.requestUpdate();
// Unset select-all if selectedElements is empty
if (this.selectedElements.length < 1) {
const selectAllCheckbox =
this.shadowRoot?.querySelector<HTMLInputElement>(
"[name=select-all]",
);
if (!selectAllCheckbox) {
return;
}
selectAllCheckbox.checked = false;
this.requestUpdate();
}
}}
/>
</td>`
@ -375,6 +387,7 @@ export abstract class Table<T> extends LitElement {
${this.checkbox
? html`<td class="pf-c-table__check" role="cell">
<input
name="select-all"
type="checkbox"
aria-label=${t`Select all rows`}
@input=${(ev: InputEvent) => {