According to my questions about adding an element to a ui, i am now stuck at updating the inventory/bank listing.
lua Code:
local backpack = ZO_PlayerInventoryBackpack
local invBackup = backpack.data
local function GetSingularName(name)
for match in string.gmatch(name, "([^\^]+)") do
return match
end
return ""
end
local function searchItem(editbox)
local text = editbox:GetText()
local filteredBackpack = {}
local startIndex = 1
for x, row in pairs(invBackup) do
local bagId = row.data.bagId
local slotIndex = row.data.slotIndex
local itemName = GetSingularName(GetItemName(bagId, slotIndex))
if (text == "" or string.match(itemName:lower(), text:lower())) then
filteredBackpack[startIndex] = row
startIndex = startIndex + 1
end
end
backpack.data = filteredBackpack
end
That does work to some extend. But the inventory list is not updated or redrawn unless i scroll up and down. The scrollbar, however, still remains.
I need some of these not (well) documented miracle function calls, i guess