Skip to content

Dynamic Dropdowns

R41z0r edited this page Jun 13, 2026 · 1 revision

Contents
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
end
menuHeight = 300

Wiki
  • 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

Clone this wiki locally