Originally Posted by Fizzlemizz
You don't create new rows in the list, you create the number of rows you want to display and then re-use them with information from your source table as you scroll through it.
|
Right, I got that and think I'm doing that.
My issue is that updates to the existing rows are not taking effect. I get the prints here for hiding existing frames, setting the new string, and then showing the updates frame. But, the content of the frame does not change on screen. I will have to check your example closely to see if there's a weird parenting issue or something because I'm following the same approach I think.
Lua Code:
local function CreateSpellList()
for key, value in pairs(row) do
ADDON.Print("Hiding")
value:ClearSpell()
end
row[1] = ADDON.SpellRow:CreateRow(listScrollFrame, 1, 1)
row[1]:GetFrame():SetPoint('TOPLEFT', 'AAOptionsFrame', 'TOPLEFT', 25, -10)
local currentRow = 1
for spellId, _ in pairs(AstralAnalytics.spellIds[currentDropdownValue]) do
if row[currentRow] == nil then
ADDON.Print('new row for ' .. currentRow .. ' with id ' .. spellId)
row[currentRow] = ADDON.SpellRow:CreateRow(listScrollFrame, currentRow, spellId)
row[currentRow]:GetFrame():SetPoint('TOPLEFT', 'spellIdRow' .. currentRow-1, 'BOTTOMLEFT', 0, 0)
else
ADDON.Print('setting existing row for ' .. currentRow .. ' with id ' .. spellId)
row[currentRow]:SetSpell(spellId)
row[currentRow]:GetFrame():Show()
end
currentRow = currentRow + 1
end
ADDON.Print(table.getn(row))
end