diff --git a/src/autocomplete.ts b/src/autocomplete.ts index 56619e76aa..4657b0320c 100644 --- a/src/autocomplete.ts +++ b/src/autocomplete.ts @@ -524,6 +524,7 @@ export class Autocomplete extends Component { /** * Sets selected values. + * @deprecated @see https://github.com/materializecss/materialize/issues/552 * @param entries */ setValues(entries: AutocompleteData[]) { @@ -564,4 +565,13 @@ export class Autocomplete extends Component { this._updateSelectedInfo(); this._triggerChanged(); } + + selectOptions(ids: []) { + const entries = this.menuItems.filter( + (item) => !(ids.indexOf(item.id) === -1) + ); + if (!entries) return; + this.selectedValues = entries; + this._renderDropdown(); + } }