Well we'll need to check where foreachinorder() is used so we can find out how it's used.
Looking at the image you provided, it doesn't look like it's in alphabetical order unless I'm completely missing something.
edit: Alright, this might work.
Interface\AddOns\PriorityList\options_itemlist.lua:539-547
change
Code:
table.foreach(mainlist,
function(k,v)
if not result then result = true end
if type(k) == "string" then
InsertChar(k,v)
elseif type(k) == "number" then
InsertItem(k,v)
end
end)
to
Code:
local itemorder={}
table.foreach(mainlist,
function(k,v)
if not result then result = true end
if type(k) == "string" then
InsertChar(k,v)
elseif type(k) == "number" then
local bossnum=tonumber((gsub(strsub(addon:MatchBossDrop(k),1,2),"#","",1)))
itemorder[bossnum]=itemorder[bossnum] or {}
tinsert(itemorder[bossnum],k)
end
end)
for i=1,20 do --assume total bosses in an instance is <=20
if itemorder[i] then
for _,v in ipairs(itemorder[i]) do
InsertItem(v,mainlist[v])
end
end
end