-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Between re-renderings of a selection list, I want to clear the checkboxes and reset the search value.
I found this difficult to do -- perhaps an internal method or property to enable this would be good:
Here's what I'm doing:
clearSelection(): void {
if (this.selectionList) {
(
Array.from(
this.selectionList.shadowRoot!.querySelectorAll(
'md-list.listitems md-list-item md-checkbox',
),
) as MdCheckbox[]
).forEach((cb): void => {
if (cb.checked) {
// eslint-disable-next-line no-param-reassign
cb.checked = false;
cb.dispatchEvent(new Event('change'));
cb.requestUpdate();
}
});
const searchField = (this.selectionList.shadowRoot!.querySelector(
'md-outlined-text-field[placeholder="search"]',
) as MdOutlinedTextField)!;
searchField.value = '';
searchField.dispatchEvent(new Event('input'));
}
}It may be that I'm using it incorrectly of course.
Metadata
Metadata
Assignees
Labels
No labels