Logic Machine Forum
how to sort the names listed ? - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: how to sort the names listed ? (/showthread.php?tid=6084)



how to sort the names listed ? - Simuzer - 21.08.2025

Hi all,

How can we sort the names listed on the left side under the widget ?
For example in alphabetical order ?

It is very difficult for me to find the widget like this.

Is there a solution for this?

Thank you for your helps.

its ok on "Vis. Structure"..
But its not ok "visualization"


RE: how to sort the names listed ? - admin - 21.08.2025

This will be fixed in the next firmware.

Meanwhile you can run this script to fix the sort order.
Code:
function sort(itype)
  local query = 'SELECT id, name FROM visfloors WHERE type=?'
  local items = db:getall(query, itype)
  
  table.sort(items, function(a, b)
    return a.name < b.name
  end)

  for i, item in ipairs(items) do
    db:update('visfloors', { sortorder = i }, { id = item.id })
  end
end

sort('widget')
sort('layout')



RE: how to sort the names listed ? - Simuzer - 21.08.2025

(21.08.2025, 07:13)admin Wrote: This will be fixed in the next firmware.

Meanwhile you can run this script to fix the sort order.
Code:
function sort(itype)
  local query = 'SELECT id, name FROM visfloors WHERE type=?'
  local items = db:getall(query, itype)
 
  table.sort(items, function(a, b)
    return a.name < b.name
  end)

  for i, item in ipairs(items) do
    db:update('visfloors', { sortorder = i }, { id = item.id })
  end
end

sort('widget')
sort('layout')

Its ok !

Thank you a lot.