mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -05:00
improve dropdown autopopulation behavior (#23420)
This commit is contained in:
@@ -241,9 +241,9 @@ export function selectDefaultDropdownValue(dropDown: DropDownComponent, value?:
|
||||
if (value) {
|
||||
const searchValue = value.toLowerCase();
|
||||
if (useDisplayName) {
|
||||
selectedIndex = dropDown.values.findIndex((v: any) => (v as CategoryValue)?.displayName?.toLowerCase() === searchValue);
|
||||
selectedIndex = dropDown.values?.findIndex((v: any) => (v as CategoryValue)?.displayName?.toLowerCase() === searchValue);
|
||||
} else {
|
||||
selectedIndex = dropDown.values.findIndex((v: any) => (v as CategoryValue)?.name?.toLowerCase() === searchValue);
|
||||
selectedIndex = dropDown.values?.findIndex((v: any) => (v as CategoryValue)?.name?.toLowerCase() === searchValue);
|
||||
}
|
||||
} else {
|
||||
selectedIndex = -1;
|
||||
@@ -1169,7 +1169,7 @@ export function createRegistrationInstructions(view: ModelView, testConnectionBu
|
||||
}).component();
|
||||
}
|
||||
|
||||
export function clearDropDown(dropDown: DropDownComponent): void {
|
||||
dropDown.values = [];
|
||||
dropDown.value = undefined;
|
||||
export async function clearDropDown(dropDown: DropDownComponent): Promise<void> {
|
||||
await dropDown.updateProperty('value', undefined);
|
||||
await dropDown.updateProperty('values', []);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user