Skip to content

Commit 4f86ea4

Browse files
committed
Sort blank items at the bottom
1 parent 2be02bc commit 4f86ea4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Export/Classes/RowListControl.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,18 @@ function RowListClass:ReSort(colIndex)
215215
local valA = self:GetRowValue(colIndex, nil, a)
216216
local valB = self:GetRowValue(colIndex, nil, b)
217217

218+
local isBlankA = valA == nil or valA == "" or tostring(valA):match("^%s*$")
219+
local isBlankB = valB == nil or valB == "" or tostring(valB):match("^%s*$")
220+
221+
-- Always put blank items at the bottom
222+
if isBlankA and not isBlankB then
223+
return false
224+
elseif not isBlankA and isBlankB then
225+
return true
226+
elseif isBlankA and isBlankB then
227+
return false
228+
end
229+
218230
local numA = tonumber(valA)
219231
local numB = tonumber(valB)
220232

0 commit comments

Comments
 (0)