Fixed table sort order

This commit is contained in:
Luca Deri 2016-11-30 16:50:11 +01:00
parent 091378fd7b
commit c5343e29e4
3 changed files with 14 additions and 18 deletions

View file

@ -20,8 +20,10 @@ long_names = _GET["long_names"]
criteria = _GET["criteria"]
criteria_key = nil
sortPrefs = "hosts"
if(criteria ~= nil) then
criteria_key, criteria_format = label2criteriakey(criteria)
sortPrefs = "localhosts"
end
-- Host comparison parameters
@ -63,32 +65,26 @@ else
end
end
if((sortColumn == nil) or (sortColumn == "column_"))then
if(criteria == nil) then
sortColumn = getDefaultTableSort("hosts")
else
sortColumn = getDefaultTableSort("localhosts")
end
sortColumn = getDefaultTableSort(sortPrefs)
else
if((sortColumn ~= "column_")
and (sortColumn ~= "")) then
tablePreferences("sort_hosts",sortColumn)
tablePreferences("sort_"..sortPrefs,sortColumn)
end
end
if(sortOrder == nil) then
if(criteria == nil) then
sortOrder = getDefaultTableSortOrder("hosts")
else
sortOrder = getDefaultTableSortOrder("localhosts")
end
sortOrder = getDefaultTableSortOrder(sortPrefs)
else
if((sortColumn ~= "column_")
and (sortColumn ~= "")) then
tablePreferences("sort_order_hosts",sortOrder)
tablePreferences("sort_order_"..sortPrefs,sortOrder)
end
end
if(currentPage == nil) then
currentPage = 1
else
@ -129,7 +125,6 @@ if(hosts_stats == nil) then total = 0 else total = hosts_stats["numHosts"] end
hosts_stats = hosts_stats["hosts"]
-- for k,v in pairs(hosts_stats) do io.write(k.." ["..sortColumn.."]\n") end
-- io.write("->"..total.." ["..sortColumn.."]\n")
if(all ~= nil) then
perPage = 0