One thing I want to point out to hopefully eliminate any confusion I may have caused
(maybe I should have just stayed out of it & let him answer :P)
I know merlight kept saying don't overwrite CustomerList:New() ...but, yet that's exactly what I did.
It looks like we both did the same thing, but with a different approach.
Since:
Lua Code:
CustomerList = ZO_SortFilterList:Subclass()
CustomerList already has a New() & an Initialize() function (from ZO_SortFilterList:Subclass()).
I overwrote the CustomerList:New() (from ZO_SortFilterList:Subclass()) function, but then called it in MY New() function.
I call the :New() function I created, which calls the original :New() function, which then calls the original Initialize() function so both the original :New() & :Initialize() both still run.
Lua Code:
function CustomerList:New()
-- ZO_SortFilterList:New(...) is the function I'm overwriting
-- So I call it here
local manager = ZO_SortFilterList.New(self, CustomerListContainer)
...
end
Merlight left the original CustomerList:New() function (from ZO_SortFilterList:Subclass()) and overwrote the CutomerList:Initialize() function, but then he manually called it in his Initialize()
He calls the Original :New() function, which automatically calls the :Initialize() function that he wrote and it calls the original :Initialize() function. So again both the original :New() & :Initialize() functions get ran.
Lua Code:
function CustomerList:Initialize(control)
-- ZO_SortFilterList:Initialize() is the function he is overwriting
-- So he calls it here
ZO_SortFilterList.Initialize(self, control)
...
end
He is right about the hard coding of CustomerListContainer in the code. I didn't think about it, but the same could have been accomplished this way by just passing it to the new function
Lua Code:
function CustomerList:New(control)
local manager = ZO_SortFilterList.New(self, control)
...
end
TRADESMAN.CustomerList = CustomerList:New(CustomerListContainer)