Your code was to sort groupmembers first in the friend and guild roster, right?
But that wasn't exactly what I wanted. I needed them sorted first in my own little scrolllist.
Thanks to your help I was able to modify the sort function for the SortHeader group:
Lua Code:
GOTO_PANE.sortHeaders = ZO_SortHeaderGroup:New(GOTO_PANE:GetNamedChild("Headers"), SHOW_ARROWS)
GOTO_PANE.sortHeaders:RegisterCallback(ZO_SortHeaderGroup.HEADER_CLICKED,
function(key, order)
table.sort(
ZO_ScrollList_GetDataList(GOTO_PANE.ScrollList),
function(entry1, entry2)
if isInGroup(entry1.data.playerName) then
if not isInGroup(entry2.data.playerName) then
return true -- 1 (group member) comes before 2 (non-member)
end
else
if isInGroup(entry2.data.playerName) then
return false -- 1 (non-member) comes after 2 (group member)
end
end
-- both members or both non-members, break the tie using the usual column sorting rules
return ZO_TableOrderingFunction(entry1.data, entry2.data, key, GOTO_SCROLLLIST_SORT_KEYS, order)
end)
ZO_ScrollList_Commit(GOTO_PANE.ScrollList)
end)
GOTO_PANE.sortHeaders:AddHeadersFromContainer()
I found that the default sort value set in ZO_SortHeader_Initialize did not seem to be applied (initally, the table displayed unsorted.) Here is the init call:
ZO_SortHeader_Initialize(GOTO_PANE.Headers.Name, "Name", "playerName", ZO_SORT_ORDER_UP, TEXT_ALIGN_LEFT, "ZoFontGameLargeBold")
A call to GOTO_PANE.sortHeaders:SelectHeaderByKey("playerName") after I populate the data seems to resolve that issue, but I wonder if I made an error in Sortheader_Initialize, or if there's a bug.