Tree:sort([subitems]) method
Sort Tree root items by ascending order.
Parameters
[subitems]
An optional boolean value that specifies to sort all levels of child items below the root items, defaulting to false.
Return value
This function returns no value.Example
local ui = require "ui"
local win = ui.Window("Tree:sort() sample", "fixed", 320, 240)
local button = ui.Button(win, "Sort tree", 130, 10)
local tree = ui.Tree(win, {"Sam", "David", "Jane"}, 104, 40)
function button:onClick()
win:status("Tree sorted")
tree:sort()
end
win:status("Tree is not sorted")
-- show the Window
win:show()
while win.visible do
ui.update()
end