You should also take a look at the enchantment filter for the trading house.
They have a similar problem where they want to sort the list except for the first and last element
Code:
-- Sort the tables, ensuring that the first and last entries of each table remain anchored ('any' and 'other' filters).
for _, v in pairs(enchantmentTypes) do
ZO_TradingHouse_SortComboBoxEntries(v, ZO_SORT_BY_NAME, ZO_SORT_ORDER_UP, ANCHOR_FIRST_ENTRY, ANCHOR_LAST_ENTRY)
end