how change items in Select Element when items is a function #240
Answered
by
adamberecz
hosseinjarrahi
asked this question in
Questions
-
hi bro, i have two SelectElement. When I select first, i want to change second SelectElement items function, in below code i show you what i think. const schema = {
model_type: {
title: "forces",
object: false,
type: "select",
items: ["a", "b", "c"],
rules: "required",
onChange: (...args) => {
const urls = {
a: "/_/a",
b: "/_/b",
c: "/_/c",
};
const el$ = args[2].form$.el$;
const el = el$("model_id");
el.items = get({ url: urls[args[0]] });
el.updateItems();
},
},
model_id: {
title: "نوع",
object: false,
type: "select",
items: get({ url: "/_/track/airplane|airplane" }),
rules: "required",
},
}; get function return a function to get the data |
Beta Was this translation helpful? Give feedback.
Answered by
adamberecz
May 9, 2024
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hosseinjarrahi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please refer to these two recipes:
https://vueform.com/recipes/dynamically-load-options-to-chained-select-boxes-from-endpoint
https://vueform.com/recipes/dynamically-load-options-to-chained-select-boxes-with-async-functions