Thread Tools Display Modes
10/27/14, 04:14 AM   #1
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
ZO_PlayerInventorySortByNew:SetHidden

Is there an easy way to hide the "New" sort header in the inventory backpack when an addon loads?

I tried doing this on player activation:
Lua Code:
  1. ZO_PlayerInventorySortByNew:SetHidden(true)

But it must be reset to visible somewhere as the game is loading because that doesn't work.
  Reply With Quote
10/27/14, 06:41 AM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
There are internal tables used to hide some columns base on current filter:
Lua Code:
  1. -- Inventory.lua
  2.  
  3.     local typicalHiddenColumns =
  4.     {
  5.         ["statValue"] = true,
  6.     }
  7.  
  8.     local questHiddenColumns =
  9.     {
  10.         ["statValue"] = true,
  11.         ["age"] = true,
  12.         ["stackSellPrice"] = true,
  13.     }
  14.  
  15.     local gearHiddenColumns =
  16.     {
  17.         -- Don't hide anything!
  18.     }
  19.  
  20.     local tradingHouseHiddenColumns =
  21.     {
  22.         ["statValue"] = true,
  23.         ["age"] = true,
  24.     }

You can get hold of these via backpack inventory, for example:
Lua Code:
  1. -- untested
  2.  
  3. local function getHiddenColumnsByFilterType(inventory, filterType)
  4.    for i, tabData in ipairs(inventory.tabFilters) do
  5.       -- the second comparison is a bit of a hack;
  6.       -- unlike all other filters, TradingHouseFilter is a local function in Inventory.lua,
  7.       -- so we have no value to compare with -- compare type instead
  8.       if tabData.filterType == filterType or type(tabData.filterType) == filterType then
  9.          return tabData.hiddenColumns
  10.       end
  11.    end
  12. end
  13.  
  14. local inventory = PLAYER_INVENTORY.inventories[INVENTORY_BACKPACK]
  15. local typicalHiddenColumns = getHiddenColumnsByFilterType(inventory, ITEMFILTERTYPE_ALL)
  16. local questHiddenColumns = getHiddenColumnsByFilterType(inventory, ITEMFILTERTYPE_QUEST)
  17. local gearHiddenColumns = getHiddenColumnsByFilterType(inventory, ITEMFILTERTYPE_ARMOR)
  18. local tradingHouseHiddenColumns = getHiddenColumnsByFilterType(inventory, "function")
  19.  
  20. -- then add a truthful value for "age"
  21. typicalHiddenColumns["age"] = "hidden by add-on Foo"
  Reply With Quote
10/27/14, 07:40 AM   #3
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by merlight View Post
There are internal tables used to hide some columns base on current filter:
Lua Code:
  1. -- Inventory.lua
  2.  
  3.     local typicalHiddenColumns =
  4.     {
  5.         ["statValue"] = true,
  6.     }
  7.  
  8.     local questHiddenColumns =
  9.     {
  10.         ["statValue"] = true,
  11.         ["age"] = true,
  12.         ["stackSellPrice"] = true,
  13.     }
  14.  
  15.     local gearHiddenColumns =
  16.     {
  17.         -- Don't hide anything!
  18.     }
  19.  
  20.     local tradingHouseHiddenColumns =
  21.     {
  22.         ["statValue"] = true,
  23.         ["age"] = true,
  24.     }

You can get hold of these via backpack inventory, for example:
Lua Code:
  1. -- untested
  2.  
  3. local function getHiddenColumnsByFilterType(inventory, filterType)
  4.    for i, tabData in ipairs(inventory.tabFilters) do
  5.       -- the second comparison is a bit of a hack;
  6.       -- unlike all other filters, TradingHouseFilter is a local function in Inventory.lua,
  7.       -- so we have no value to compare with -- compare type instead
  8.       if tabData.filterType == filterType or type(tabData.filterType) == filterType then
  9.          return tabData.hiddenColumns
  10.       end
  11.    end
  12. end
  13.  
  14. local inventory = PLAYER_INVENTORY.inventories[INVENTORY_BACKPACK]
  15. local typicalHiddenColumns = getHiddenColumnsByFilterType(inventory, ITEMFILTERTYPE_ALL)
  16. local questHiddenColumns = getHiddenColumnsByFilterType(inventory, ITEMFILTERTYPE_QUEST)
  17. local gearHiddenColumns = getHiddenColumnsByFilterType(inventory, ITEMFILTERTYPE_ARMOR)
  18. local tradingHouseHiddenColumns = getHiddenColumnsByFilterType(inventory, "function")
  19.  
  20. -- then add a truthful value for "age"
  21. typicalHiddenColumns["age"] = "hidden by add-on Foo"
So something like this:
Lua Code:
  1. local tabFilters = PLAYER_INVENTORY.inventories[INVENTORY_BACKPACK].tabFilters
  2. for _, filter in pairs(tabFilters) do
  3.     filter.hiddenColumns["age"] = true
  4. end

Or hack to hide header, but leave column visible:
Lua Code:
  1. ZO_PlayerInventorySortByNew:SetHidden(true)
  2. ZO_PlayerInventorySortByNew:SetHandler("OnShow", function(self) self:SetHidden(true) end)
  Reply With Quote
10/27/14, 08:42 PM   #4
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Oh yeah, I'de written some tabFilters for JunkIts inventory filters, but I forgot all about those hidden column tables.

Awesome idea, thanks for the help both of you, worked great.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » ZO_PlayerInventorySortByNew:SetHidden


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