View Single Post
10-14-21, 05:54 PM   #3
Khazak
A Murloc Raider
 
Khazak's Avatar
Join Date: Oct 2021
Posts: 4
Originally Posted by Fizzlemizz View Post
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:
  1. local function CreateSpellList()
  2.     for key, value in pairs(row) do
  3.         ADDON.Print("Hiding")
  4.         value:ClearSpell()
  5.     end
  6.  
  7.     row[1] = ADDON.SpellRow:CreateRow(listScrollFrame, 1, 1)
  8.     row[1]:GetFrame():SetPoint('TOPLEFT', 'AAOptionsFrame', 'TOPLEFT', 25, -10)
  9.     local currentRow = 1
  10.     for spellId, _ in pairs(AstralAnalytics.spellIds[currentDropdownValue]) do
  11.         if row[currentRow] == nil then
  12.             ADDON.Print('new row for ' .. currentRow .. ' with id ' .. spellId)
  13.             row[currentRow] = ADDON.SpellRow:CreateRow(listScrollFrame, currentRow, spellId)
  14.             row[currentRow]:GetFrame():SetPoint('TOPLEFT', 'spellIdRow' .. currentRow-1, 'BOTTOMLEFT', 0, 0)
  15.         else
  16.             ADDON.Print('setting existing row for ' .. currentRow .. ' with id ' .. spellId)
  17.             row[currentRow]:SetSpell(spellId)
  18.             row[currentRow]:GetFrame():Show()
  19.         end
  20.         currentRow = currentRow + 1
  21.     end
  22.     ADDON.Print(table.getn(row))
  23. end
  Reply With Quote