Dynamic Dropdown with remote content
See original GitHub issueHi, I wrote my code like that
$('.dropdown#brands')
.dropdown({
apiSettings: {
url: 'https://sneakerfans.herokuapp.com/api/v1/allbrands',
},
fields: {
remoteValues: 'brands',
name: 'brand_name',
value: 'id'
},
allowReselection: 'ture',
placeholder: 'select brands',
direction: 'downward',
onChange: (value, text, $choice) => {
regvue.brand_id = value
if (!regvue.tech) {
regvue.tech = true
}
$('#techs')
.dropdown({
placeholder: 'select techs',
fields: {
remoteValues: 'techs',
name: "tech_name",
value: "id"
},
apiSettings: {
url: 'https://sneakerfans.herokuapp.com/api/v1/gettechs',
method: 'post',
beforeSend: (settings) => {
console.log(regvue.brand_id)
$('#techs').dropdown('refresh')
settings.data = {
brand_id: regvue.brand_id,
}
return settings
}
}
});
}
});
There should be two dropdowns, first use api to get content from server, and when first dropdown change its value, the second dropdown use api and the value from first dropdown to get a different options.
However, the second dropdown content doesn’t change when I change first dropdown value.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
So You Need To Fill a Dropdown Dynamically
The first one has three options. The first just informs the user to select an option, and the next two are actual choices....
Read more >Create a Dynamic Dropdown List - Google Sheets - YouTube
Want to learn how to create a dynamic drop down list in Google Sheets? It happens when you click a small drop down...
Read more >change content dynamically based on dropdown select
You code works fine, just you need to add eventListener , which calls changes every-time when you change dropdown value of select, as...
Read more >Dynamic dropdown list from a linked sheet
Hi, wondering if it's possible to have a dropdown list in ... But is it possible to use a custom (remote) source for...
Read more >Dynamic Dropdown - Resource Center
A new content dropdown field type is now available in the widget builder. Now you can dynamically populate a dropdown field in a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As of 2.2.9 you should be able to do this like below. No
sessionStorage.removeItem
should be needed. Also, I use class selectors instead of ids, looks cleaner.Now, once you click inside the techs field it should display the correct filtered options based on the brands selection.
Use:
$('#drop').dropdown('change values',null);
The next click will in#drop
will trigger the query…