Skip to content

Commit

Permalink
Retain default value
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Sep 30, 2024
1 parent 1137b55 commit 6acb06b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/basic/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ const valueSetter = AtomControl.registerProperty("data-items", "value", (ctrl, e
const refreshItems = (element: HTMLSelectElement, items?: any[]) => {
items ??= element["items"];
(element as any).update = true;
const old = element.selectedIndex;
let cv = element["initialValue"];
if (old !== -1) {
cv = element["value"];
}
element.options.length = 0;
const cv = element["initialValue"] ?? element["value"];
const lp = element["labelPath"] ?? ((item) => item?.label ?? item);
const vp = element["valuePath"] ?? ((item) => item?.value ?? item);
let i = 0;
Expand Down

0 comments on commit 6acb06b

Please sign in to comment.