How to sort tree by node attribute? #341
Unanswered
Otterpatsch
asked this question in
Q&A
Replies: 1 comment
-
You can sort Currently |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello there,
I want to sort the nodes by their attribute timestemp. But still keep the parent/child relationship intact. So basically only sort the root nodes even tho the child nodes should be sorted too but thats optional if not feasible.
So currently i guess as i use pairs to add nodes to the tree is unsorted as values was sorted
As the keys of node_by_id is some integer as string (id attribute of a value from a api call)
I thought okay sort afterwards the nodes of the tree and just create a new tree with the sorted nodes. Which atleast doenst throw any error but is also not sorting as expected.
as the output is lacking some nodes and the parent/child relationship is broken.
###I tried:
bad result
unsorted result
Things which might be helpful to reproduce
repo function M.comments_view(values)
values is basically just a concataned table of all response.bodys of those 3 pages
Beta Was this translation helpful? Give feedback.
All reactions