View Single Post
06/14/21, 01:46 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,966
I'm not sure that the normal ZO_ScrollList is defined to have more than 1 column but the ZO_SortFilterList got it.
But it's more complicated.

The basic info you need is that the function here
ZO_ScrollList_AddDataType(control, typeId, templateName
uses the templateName as 3rd parameter.
e.g.
templateName = "MyUniqueAddonsXMLRowTemplateName"

You need to define the templatename as XML "virtual" row control like that:

Code:
<GuiXml>
    <Controls>
        <!-- Virtual row for the ZO_SortList of this widget -->
        <Label name="MyUniqueAddonsXMLRowTemplateName" mouseEnabled="true" virtual="true" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_NORMAL">
            <OnInitialized>
                ZO_SelectableLabel_OnInitialized(self)
            </OnInitialized>

            <OnMouseEnter>
                ZO_SelectableLabel_OnMouseEnter(self)
            </OnMouseEnter>
            <OnMouseExit>
                ZO_SelectableLabel_OnMouseExit(self)
            </OnMouseExit>
            <OnDragStart>
                LAM2_orderlistbox_widget_OnDragStart(self, button)
            </OnDragStart>
            <OnReceiveDrag>
                LAM2_orderlistbox_widget_OnReceiveDrag(self, button)
            </OnReceiveDrag>
        </Label>
In the XML code you could try if adding more than 1 label controls after another, anchoring them to each other's (2nd label anchor it's left to the right of the first label) will add another column then.


In the scroll list you need to use the data table of the row then to populate the data table's column to the XML's column.
This can be done via the setupFunction e.g. or other functions like ZO_SortList:BuildMasterList (I think this was the name).


If you change your XML file to
<Control name="$(parent)List" inherits="ZO_SortFilterList">
you must add a SortHeader control to it as well!
And define the row template etc. like described abobe. This should work then for sure.

Examples of the ZO_SortFilterList can be found in ZOs code or other addons like WishList e.g.
The WishList XML got some comments which might help.
The lua code is in file WL_window.lua then.
I'm using 1 ZO_SortFilterLists there which just changes the visible columns and populates other data for 3 different output tabs (add items, wishlist and history).
If you need further assistance there feel free to ask.

Additional info about the ZO_SortList etc. can be found here, including the function call order of the ZO_SortFilterList:
https://wiki.esoui.com/How_to..._do_...templated_rows

Last edited by Baertram : 06/14/21 at 01:53 AM.
  Reply With Quote