Thread Tools Display Modes
09/04/15, 07:45 PM   #1
Argusus
AddOn Author - Click to view addons
Join Date: Sep 2014
Posts: 120
ZO_Templates ScrollTemplates

Hello,

Does anyone have recommendations for me change my Scroll lists in TradesMan? It looks like they have removed or deprecated the Filter ScrollList base I was relying on to build my addon. any feedback/suggestions are appreciated! below is the message i'm getting since the new update.

  Reply With Quote
09/04/15, 08:23 PM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
You're either passing nil instead of proper list control to ZO_ScrollList_AddDataType, or it hasn't been initialized properly with ZO_ScrollList_Initialize.
  Reply With Quote
09/04/15, 08:30 PM   #3
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Ok, read some more.

In order to be used as ZO_SortFilterList, CustomerListContainer must contain a control named "$(parent)List" that inherits="ZO_ScrollList".

Delete all your X:New functions, they're not needed, and wrong. ZO_SortFilterList.New itself calls :Initialize, you don't want to call it a second time. Fix your :Initialize functions to call the base as the very first thing.
  Reply With Quote
09/04/15, 08:41 PM   #4
Argusus
AddOn Author - Click to view addons
Join Date: Sep 2014
Posts: 120
Originally Posted by merlight View Post
Ok, read some more.

In order to be used as ZO_SortFilterList, CustomerListContainer must contain a control named "$(parent)List" that inherits="ZO_ScrollList".

Delete all your X:New functions, they're not needed, and wrong. ZO_SortFilterList.New itself calls :Initialize, you don't want to call it a second time. Fix your :Initialize functions to call the base as the very first thing.
cool thanks for the information. So I should remove the calls in TradesMan when calling new? on line 1277 I have TRADESMAN.CustomerList = CustomerList:New() which then calls Initialize, then I have these for my x:New functions.


Code:
function CustomerList:New()
	local customers = ZO_SortFilterList.New(self, CustomerListContainer)
	customers:Initialize()
	return customers
end
  Reply With Quote
09/04/15, 08:58 PM   #5
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Remove the function CustomerList:New(), it's overriding the base with nothing "new" to add

TRADESMAN.CustomerList = CustomerList:New(CustomerListContainer)
will work just fine without it, because CustomerList is already defined as ZO_SortFilterList:Subclass(), so it will call the correct New and YOUR Initialize (that's why you need to call ZO_SortFilterList.Initialize from there)
  Reply With Quote
09/04/15, 09:17 PM   #6
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Example: (I combined your New & Initialize functions)
Lua Code:
  1. function CustomerList:New()
  2.     local manager = ZO_SortFilterList.New(self, CustomerListContainer)
  3.     manager.masterList = {}
  4.    
  5.     ZO_ScrollList_AddDataType(manager.list, 1, "CustomerUnitRow", 30, function(control, data) manager:SetupUnitRow(control, data) end)
  6.     ZO_ScrollList_EnableHighlight(manager.list, "ZO_ThinListHighlight")
  7.     manager.sortFunction = function(listEntry1, listEntry2) return ZO_TableOrderingFunction(listEntry1.data, listEntry2.data, manager.currentSortKey, CustomerList.SORT_KEYS, manager.currentSortOrder) end
  8.     manager.sortHeaderGroup:SelectHeaderByKey("name")
  9.     manager:RefreshData()
  10.    
  11.     return manager
  12. end
  13.  
  14. TRADESMAN.CustomerList = CustomerList:New()

Last edited by circonian : 09/04/15 at 09:21 PM.
  Reply With Quote
09/04/15, 10:10 PM   #7
Argusus
AddOn Author - Click to view addons
Join Date: Sep 2014
Posts: 120
Originally Posted by merlight View Post
Remove the function CustomerList:New(), it's overriding the base with nothing "new" to add

TRADESMAN.CustomerList = CustomerList:New(CustomerListContainer)
will work just fine without it, because CustomerList is already defined as ZO_SortFilterList:Subclass(), so it will call the correct New and YOUR Initialize (that's why you need to call ZO_SortFilterList.Initialize from there)
thanks for the quick responses! I really appreciate it Mer!
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » ZO_Templates ScrollTemplates


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off