1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
--[[
This class allows a parametric list to have sort headers to allow the user to change how the list is sorted
To setup, your main control needs to have a "Headers" child that has all the sort headers and
a "List" child that defines the scroll list
The children of "Headers" should have their OnInitialized call ZO_SortableParametricList_InitSortHeader
(or other init sort header function) passing in the sortKey that header will use
ex: ZO_SortableParametricList_InitSortHeader(self, SI_LABEL_GOES_HERE, TEXT_ALIGN_LEFT, MY_SORT_KEY_NAME)
To associate the data in the list with the sortKeys in the header, the function SetSortOptions needs to be called,
passing in a table where the sortKeys used to initialize the headers are the table key and the value is a table
the defines the list's sort options for that key
in this ex. both name and price are members of the list data
local NAME_SORT_KEYS =
{
name = {tiebreaker = "price"},
price = {}
}
local PRICE_SORT_KEYS =
{
price = {tiebreaker = "name"},
name = {}
}
local tradingHouseSortOptions = {
[MY_SORT_KEY_NAME] = NAME_SORT_KEYS,
[MY_SORT_KEY_PRICE] = PRICE_SORT_KEYS,
}
self:SetSortOptions(tradingHouseSortOptions)
Once the sorting is setup, you just need to create a BuildList() function in your derived class to populate the list
]]
return manager
end
self . sortHeaderGroup : RegisterCallback ( ZO_SortHeaderGroup . HEADER_CLICKED , function ( key , order ) self : OnSortHeaderClicked ( key , order ) end )
end
end
end
end
end
end
end
else
end
end
end
end
end
end
-- Funtions that wrap functions in ZO_SortHeaderGroup
end
end
end
end
end
-- Functions that wrap functions in ZO_ParametricScrollList
if dontReselect == nil then
dontReselect = true
end
end
end
-- ZO_SortFilterListBase overridden functions
end
end
end
--- No Filters
end
end
-- Functions to be overridden
--- should be overridden to call AddDataTemplate & handle needed callbacks
end
-- intended to be overridden
-- should populate the itemList by calling AddEntry
end
-- Globals
ZO_SortHeader_Initialize ( header , GetString ( stringId ) , sortKey , ZO_SORT_ORDER_UP , textAlignment or TEXT_ALIGN_LEFT , "ZoFontHeader" )
end |