Allow to restore the selection by setting the value.
This commit is contained in:
@@ -62,6 +62,16 @@ class TpMultiToggle extends FormElement(LitElement) {
|
||||
}
|
||||
}
|
||||
|
||||
set value(val) {
|
||||
this.querySelectorAll('tp-button').forEach(el => {
|
||||
if (el.getAttribute(this.attr || 'id') === val) {
|
||||
el.setAttribute('selected', '');
|
||||
} else {
|
||||
el.removeAttribute('selected');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.boundClick = this.onClick.bind(this);
|
||||
|
||||
Reference in New Issue
Block a user