Results 1 to 1 of 1
Thread: nested sets and sorting nodes
Nov 17, 2008, 08:43 #1
- Join Date
- Nov 2005
- 0 Post(s)
- 0 Thread(s)
nested sets and sorting nodes
I must decided how to implement categorized structure and I wanted to based it on SQL.
I thought nested sets implementation would be good because it is quite easy. To add a node, delete node, retrive parents, children or even generate a whole tree is trivial. I additionaly store in db depth and parent id to the node to speed some selects and avoid spare calculations.
However, when I tried to order nodes on the same level I fount it quite difficult.
In short, I have to rebuilt the tree.
Here is an example:
- x0 - - x00 - - x01 - x1 - - x10 - - x11
Does order operation in nested sets always mean updating two whole branches? Is there a way to update only nodes. I really don`t like the idea of changing so many records.
Maybe I should consider other approach?
Thanks for any advices.