some listing refactoring
This commit is contained in:
@@ -153,8 +153,13 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_cell_click,
|
||||
row:SetPoint('TOPRIGHT', labels[getn(columns)], 'BOTTOMRIGHT', 0, -((row_index-1) * 14))
|
||||
row:RegisterForClicks("LeftButtonDown", "RightButtonDown")
|
||||
row:SetHeight(14)
|
||||
row.cells = {}
|
||||
|
||||
local row_index = row_index
|
||||
row:SetScript("OnClick", function() if sheet.on_row_click then sheet.on_row_click(sheet, row_index) end end)
|
||||
row:SetScript("OnEnter", function() if sheet.on_row_enter then sheet.on_row_enter(sheet, row_index) end end)
|
||||
row:SetScript("OnLeave", function() if sheet.on_row_leave then sheet.on_row_leave(sheet, row_index) end end)
|
||||
|
||||
row.cells = {}
|
||||
for i = 1,getn(columns) do
|
||||
local cell = CreateFrame('Button', nil, content)
|
||||
cell:SetPoint('TOPLEFT', labels[i], 'BOTTOMLEFT', 0, -((row_index-1) * 14))
|
||||
@@ -163,7 +168,7 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_cell_click,
|
||||
|
||||
cell:SetHeight(14)
|
||||
|
||||
local row_index, column_index = row_index, i
|
||||
local column_index = i
|
||||
cell:SetScript("OnClick", function() if sheet.on_cell_click then sheet.on_cell_click(sheet, row_index, column_index) end end)
|
||||
cell:SetScript("OnEnter", function() if sheet.on_cell_enter then sheet.on_cell_enter(sheet, row_index, column_index) end end)
|
||||
cell:SetScript("OnLeave", function() if sheet.on_cell_leave then sheet.on_cell_leave(sheet, row_index, column_index) end end)
|
||||
|
||||
+3
-3
@@ -13,16 +13,16 @@ local set_auction, update_auction_listing, update_inventory_listing, record_auct
|
||||
local LIVE, HISTORICAL, FIXED = 1, 2, 3
|
||||
|
||||
Aux.sell.inventory_listing_config = {
|
||||
on_cell_click = function (sheet, row_index, column_index)
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
set_auction(sheet.data[data_index])
|
||||
end,
|
||||
|
||||
on_cell_enter = function (sheet, row_index, column_index)
|
||||
on_row_enter = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
end,
|
||||
|
||||
on_cell_leave = function (sheet, row_index, column_index)
|
||||
on_row_leave = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
if not (current_auction and sheet.data[data_index] == current_auction) then
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
|
||||
@@ -278,6 +278,15 @@ Aux.buy.modes = {
|
||||
on_cell_leave = function (sheet, row_index, column_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
end,
|
||||
|
||||
row_setter = function(row, datum)
|
||||
if current_auction and datum == current_auction then
|
||||
row.highlight:SetAlpha(.5)
|
||||
else
|
||||
row.highlight:SetAlpha(0)
|
||||
end
|
||||
end,
|
||||
|
||||
columns = {
|
||||
{
|
||||
title = 'Qty',
|
||||
|
||||
Reference in New Issue
Block a user