fix selected state of select boxes (#19743)

* fix the selected state

* add comments

* validate parameters
This commit is contained in:
Alan Ren
2022-06-15 20:41:07 -07:00
committed by GitHub
parent b980fe1106
commit e24f316ab7
3 changed files with 5 additions and 1 deletions

View File

@@ -315,6 +315,8 @@ export class Dropdown extends Disposable implements IListVirtualDelegate<string>
private _updateDropDownList(): void {
this._selectList.splice(0, this._selectList.length, this._dataSource.filteredValues.map(v => { return { text: v }; }));
const selectedIndex = this._dataSource.filteredValues.indexOf(this.value);
this._selectList.setSelection(selectedIndex !== -1 ? [selectedIndex] : []);
let width = this._inputContainer.clientWidth;