Should've posted more concrete code -- but it was way too late, sorry
-- to show why overriding New isn't needed at all thanks to how it's written (it passes all arguments to Initialize).
Lua Code:
function CustomerList:Initialize(control)
ZO_SortFilterList.Initialize(self, control)
self.masterList = {}
ZO_ScrollList_AddDataType(self.list, 1, "CustomerUnitRow", 30, function(control, data) self:SetupUnitRow(control, data) end)
ZO_ScrollList_EnableHighlight(self.list, "ZO_ThinListHighlight")
self.sortFunction = function(listEntry1, listEntry2) return ZO_TableOrderingFunction(listEntry1.data, listEntry2.data, self.currentSortKey, CustomerList.SORT_KEYS, self.currentSortOrder) end
self.sortHeaderGroup:SelectHeaderByKey("name")
self:RefreshData()
end
TRADESMAN.CustomerList = CustomerList:New(CustomerListContainer)
This way CustomerListContainer is not hard-coded in the class, thus you could create multiple instances (on different container controls). Not really useful in your case, I know, but still cleaner IMO.
Another little suggestion that's good getting used to. In BuildMasterList(), don't create a new table, discarding the old one -- unless you have a million items in there and really want to free the memory and only insert a thousand
-- just clear the existing table with
Lua Code:
ZO_ClearNumericallyIndexedTable(self.masterList)