View Single Post
03/17/19, 09:55 AM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
You need to define the function FilterScrollList and actually apply your master list to the scroll data.

Lua Code:
  1. function CharacterList:FilterScrollList()
  2.     local scrollData = ZO_ScrollList_GetDataList(self.list)
  3.     ZO_ClearNumericallyIndexedTable(scrollData)
  4.  
  5.     for i = 1, #self.masterList do
  6.         scrollData[#scrollData + 1] = ZO_ScrollList_CreateDataEntry(1, { name = self.masterList[i] })
  7.     end
  8. end

In your case it would be better to change the content of the master list so you do not have to create the data entry all the time, since characters do not change during a session anyways.


Lua Code:
  1. for i = 1, GetNumCharacters() do
  2.         table.insert(self.masterList, ZO_ScrollList_CreateDataEntry(1, { name = zo_strformat("<<1>>", GetCharacterInfo(i)) }))
  3.     end
Then you can just copy the master list:
Lua Code:
  1. function CharacterList:FilterScrollList()
  2.     local scrollData = ZO_ScrollList_GetDataList(self.list)
  3.     ZO_ClearNumericallyIndexedTable(scrollData)
  4.     ZO_ShallowTableCopy(scrollData, self.masterList)
  5. end

In addition you can also overwrite the SortScrollList function to change the sort order of your scroll list.
Lua Code:
  1. function CharacterList:SortScrollList()
  2.     local scrollData = ZO_ScrollList_GetDataList(self.list)
  3.     table.sort(scrollData, myComparisonFunction)
  4. end
  Reply With Quote