I'm using this to rebuild LAM option when someone join / leave a guild.
It rebuild the option panel, works well !
Lua Code:
-- loaded with EVENT_ADD_ONLOADED
function pChat.setup()
-- Menu and pChat.opts vor saved vars
pChat.init()
end
-- Initialises the settings and settings menu
function pChat.init()
-- Fetch the saved variables
pChat.opts = ZO_SavedVars:NewAccountWide('PCHAT_OPTS', 0.9, nil, defaults)
local panelData = {
type = "panel",
name = pChat.name,
displayName = ZO_HIGHLIGHT_TEXT:Colorize("pChat"),
author = pChat.author,
version = pChat.version,
slashCommand = "/pchat",
registerForRefresh = true,
registerForDefaults = true,
}
LAM:RegisterAddonPanel("pChatOptions", panelData)
-- Build OptionTable
pChat.buildOptionsTable()
end
-- when my event trigger :
function pChat.newGuild(event)
-- It will rebuild optionsTable and recreate tables
pChat.buildOptionsTable()
end
-- Build LAM Option Table, used when AddonLoads or when a player join/leave a guild
function pChat.buildOptionsTable()
local optionsTable = {
[1] = {
type = "header",
name = pChat.lang.optionsH,
width = "full",
},
...
LAM:RegisterOptionControls("pChatOptions", optionsTable)
end