-
Notifications
You must be signed in to change notification settings - Fork 0
Dynamic Dropdowns
local profileOrder = {}
local function getProfileOptions()
wipe(profileOrder)
local options = {}
for name in pairs(MyAddonDB.profiles or {}) do
options[name] = name
profileOrder[#profileOrder + 1] = name
end
table.sort(profileOrder)
return options
end
app:RegisterControl("profiles.select", {
id = "profile",
key = "profile",
type = "dropdown",
label = "Profile",
listFunc = getProfileOptions,
optionfunc = function() return profileOrder end,
})When a source list changes, clear invalid dependent selections and notify the row or re-render only after the dropdown interaction is closed.
if not MyAddonDB.profiles[MyAddonDB.profile.selectedProfile] then
MyAddonDB.profile.selectedProfile = nil
endmenuHeight = 300Wiki
• Home
• Architecture
• Vendoring
• Quick Start
• Field Glossary
• Troubleshooting
• Validation
Reference
⚬ Config API
⚬ UI API
⚬ Elements
⚬ Examples
Elements
Structure
• Category
• Page
• Group
• Dashboard
• InfoPage
• Custom
Controls
• Toggle
• CheckboxDropdown
• Dropdown
• MultiDropdown
• SoundDropdown
• Input
• Slider
• Button
Advanced
• ColorPicker
• ColorPalette
• ColorOverrides
• ReorderList
• Expandable
• Notes
Examples
Start
• Minimal Addon
• Complete Settings Center
• Wrapper Bridge Pattern
Data and Behavior
• Dependent Controls
• Nested Database Values
• Dynamic Dropdowns
• Runtime Refresh
• Search and New Badges
• Custom Hosted Editors
Polish
• Support Links
• Theme Colors
• Theme Borders