Thread Tools Display Modes
Prev Previous Post   Next Post Next
10/12/14, 10:17 AM   #8
Argusus
AddOn Author - Click to view addons
Join Date: Sep 2014
Posts: 120
Originally Posted by merlight View Post
I should read more carefully before pasting lines from different places. Now I think it should not suppress the callback, because it sets currentSortKey and currentSortOrder, which are then used in sortFunction.

I'd place it right before RefreshData call, without SUPPRESS_CALLBACK:

Lua Code:
  1. function UnitList:Initialize()
  2.     self.masterList = {}
  3.     ZO_ScrollList_AddDataType(self.list, 1, "UnitRow", 30, function(control, data) self:SetupUnitRow(control, data) end)
  4.     ZO_ScrollList_EnableHighlight(self.list, "ZO_ThinListHighlight")   
  5.     self.sortFunction = function(listEntry1, listEntry2) return ZO_TableOrderingFunction(listEntry1.data, listEntry2.data, self.currentSortKey, UnitList.SORT_KEYS, self.currentSortOrder) end
  6.     self.sortHeaderGroup:SelectHeaderByKey("name")
  7.     self:RefreshData()
  8. end

I'm still wondering how it could work without setting a sort key. I'd expect it to throw a "nil used as table key" error when there are 2 or more items in the list.
is there a "descending" version of that by chance?
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » ZO_Helpers


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