ScrollList not populated with data
Hi.
I'm trying to create a scroll list that will display names of all my characters but I have a problem. The master list is populated with names but the SetupRow function is never called. What should I do to populate my list with data? Here's my code: Lua - https://pastebin.com/DBjtkZ9b Xml - https://pastebin.com/bvs63t1s |
You need to define the function FilterScrollList and actually apply your master list to the scroll data.
Lua Code:
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:
Lua Code:
In addition you can also overwrite the SortScrollList function to change the sort order of your scroll list. Lua Code:
|
The "masterList" table is not actually the active list of elements that go into the list displayed to the user.
It's also worth mentioning that the tutorials on the scroll list (and ZO_libraries in general) are horrendous, and do very little to explain how they are intended to be used, so I will try to give a little info here. Lua Code:
After Subclass() is called, CharacterList is essentially an instance of ZO_SortFilterList and inherits all functions defined by it. If you only ever intend to use this list for one single display, you don't really need the "New()" function which implies that you will be creating multiple instances of the "class" The Initialize() function is still used to setup your CharacterList table with all information unique to it's purpose. Lua Code:
There are several functions meant to be overwritten by you and are called by different ZO_SortFilterList functions (the numbers in the comments are important reference later). Lua Code:
In one of the 3 mentioned functions you need to add elements to the List control as described by sirinsidiator. Lua Code:
Now that you've defined the above functions to add/filter/sort elements of your list, you'll want to call one of the inherited functions from ZO_SortFilterList (numbers referenced above) Lua Code:
So a single call to RefreshData() should render your list at this point. |
Thank you guys for your help. It works perfectly now :)
|
All times are GMT -6. The time now is 01:13 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI