You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Tweakpane 4.0.5 pane with a dropdown binding which needs to be populated with options fetched from an external API.
However, after fetching those options, even when doing pane.refresh() and/or a selector.refresh(), no fetched options appear.
What am I missing here? Is that the proper method?
I'm doing:
// Create dropdownconstselector=pane.addBinding({option: "random"},"selector",{label: "My Options",options: {Random: "random",// Will be populated with more options later},})// Fetch options for dropdownfetch(`${EXTERNAL_API}/options`).then((response)=>response.json()).then((data: {options: Option[]})=>{options=data.optionsfor(constoofoptions){constlabel=`${o.title}`constslug=slugify(o.title)selector.options[label]=slug}console.log("Fetched options:",selector.options)// Works finepane.refresh()// Tried thisselector.refresh()// Also tried this}).catch((error)=>{console.error("Failed to fetch movies:",error)})
The text was updated successfully, but these errors were encountered:
bolinocroustibat
changed the title
Can't refresh a binding
Can't refresh a dropdown binding with fetched options
Jan 30, 2025
bolinocroustibat
changed the title
Can't refresh a dropdown binding with fetched options
Can't refresh an already created binding with fetched options
Jan 30, 2025
To update the binding with new options, you should dispose of the existing binding and create a new one.
Or, if you don't need a binding feature, you can create a dropdown list without binding by Pane.addBlade() with view: 'list' option and it can change its dropdown items by changing .options: https://tweakpane.github.io/docs/blades/#list
Hello and thanks for this wonderful library!
I have a Tweakpane 4.0.5 pane with a dropdown binding which needs to be populated with options fetched from an external API.
However, after fetching those options, even when doing
pane.refresh()
and/or aselector.refresh()
, no fetched options appear.What am I missing here? Is that the proper method?
I'm doing:
The text was updated successfully, but these errors were encountered: