@@ -217,7 +217,21 @@ function TradeQueryClass:PriceItem()
217
217
-- Row spacing reference is now the name, which is a smaller font than the total height
218
218
local pane_height = (top_pane_alignment_height + row_height ) * row_count - 4 * row_count + 55
219
219
local pane_width = 850
220
- local cnt = 1
220
+
221
+ local slotTables = {}
222
+ for _ , slotName in ipairs (baseSlots ) do
223
+ t_insert (slotTables , {name = slotName })
224
+ end
225
+ local activeSocketList = { }
226
+ for nodeId , slot in pairs (self .itemsTab .sockets ) do
227
+ if not slot .inactive then
228
+ t_insert (activeSocketList , nodeId )
229
+ end
230
+ end
231
+ table.sort (activeSocketList )
232
+ for _ , nodeId in ipairs (activeSocketList ) do
233
+ t_insert (slotTables , {name = self .itemsTab .sockets [nodeId ].label , ref = nodeId })
234
+ end
221
235
222
236
local newItemList = { }
223
237
for index , itemSetId in ipairs (self .itemsTab .itemSetOrderList ) do
@@ -282,7 +296,7 @@ on trade site to work on other leagues and realms)]]
282
296
self .controls .itemSortSelection = new (" DropDownControl" , {" TOPRIGHT" , nil , " TOPRIGHT" }, - 12 , 19 , 100 , 18 , self .sortSelectionList , function (index , value )
283
297
self .pbSortSelectionIndex = index
284
298
for index , _ in pairs (self .resultTbl ) do
285
- self :UpdateControlsWithItems ({ name = baseSlots [index ]} , index )
299
+ self :UpdateControlsWithItems (slotTables [index ], index )
286
300
end
287
301
end )
288
302
self .controls .itemSortSelection .tooltipText = " Weighted Sum searches will always sort\n using descending weighted sum."
@@ -362,25 +376,11 @@ on trade site to work on other leagues and realms)]]
362
376
if self .pbRealm == " " then
363
377
self :UpdateRealms ()
364
378
end
365
-
366
379
-- Individual slot rows
367
380
top_pane_alignment_ref = {" TOPLEFT" , self .controls .poesessidButton , " BOTTOMLEFT" }
368
- for _ , slotName in ipairs (baseSlots ) do
369
- self :PriceItemRowDisplay (cnt , {name = slotName }, top_pane_alignment_ref , top_pane_alignment_width , top_pane_alignment_height , row_height )
370
- top_pane_alignment_ref = {" TOPLEFT" , self .controls [" name" .. cnt ], " BOTTOMLEFT" }
371
- cnt = cnt + 1
372
- end
373
- local activeSocketList = { }
374
- for nodeId , slot in pairs (self .itemsTab .sockets ) do
375
- if not slot .inactive then
376
- t_insert (activeSocketList , nodeId )
377
- end
378
- end
379
- table.sort (activeSocketList )
380
- for _ , nodeId in pairs (activeSocketList ) do
381
- self :PriceItemRowDisplay (cnt , {name = self .itemsTab .sockets [nodeId ].label , ref = nodeId }, top_pane_alignment_ref , top_pane_alignment_width , top_pane_alignment_height , row_height )
382
- top_pane_alignment_ref = {" TOPLEFT" , self .controls [" name" .. cnt ], " BOTTOMLEFT" }
383
- cnt = cnt + 1
381
+ for index , slotTbl in pairs (slotTables ) do
382
+ self :PriceItemRowDisplay (index , slotTbl , top_pane_alignment_ref , top_pane_alignment_width , top_pane_alignment_height , row_height )
383
+ top_pane_alignment_ref = {" TOPLEFT" , self .controls [" name" .. index ], " BOTTOMLEFT" }
384
384
end
385
385
self .controls .fullPrice = new (" LabelControl" , nil , - 3 , pane_height - 58 , pane_width - 256 , row_height , " " )
386
386
self .controls .close = new (" ButtonControl" , nil , 0 , pane_height - 30 , 90 , row_height , " Done" , function ()
@@ -464,13 +464,15 @@ function TradeQueryClass:UpdateControlsWithItems(slotTbl, index)
464
464
if errMsg == " MissingConversionRates" then
465
465
self :SetNotice (self .controls .pbNotice , " ^4Price sorting is not available, falling back to DPS sort." )
466
466
sortedItems , errMsg = self :SortFetchResults (slotTbl , index , self .sortModes .DPS )
467
- end
468
- if errMsg then
467
+ elseif errMsg then
469
468
self :SetNotice (self .controls .pbNotice , " Error: " .. errMsg )
470
469
return
470
+ else
471
+ self :SetNotice (self .controls .pbNotice , " " )
471
472
end
473
+
472
474
self .sortedResultTbl [index ] = sortedItems
473
- self .itemIndexTbl [index ] = 1
475
+ self .itemIndexTbl [index ] = self . sortedResultTbl [ index ][ 1 ]. index
474
476
self .controls [" priceButton" .. index ].tooltipText = " Sorted by " .. self .sortSelectionList [self .pbSortSelectionIndex ]
475
477
local pb_index = self .sortedResultTbl [index ][1 ].index
476
478
self .totalPrice [index ] = {
0 commit comments