Nested sets in predefined order format they require left_id and right_id. Level is an extra key to use in queries to extract for instance all children till a certain level. so, the first key in the array is the item's ID. first value is parent.
The order in array for this items is not important, everything is sorted in the database query. When you change order you change parent, left and right id for each item in part. You already have the items in the database, you just have to update those values. Blair McKenzie wrote: > If you're already depending on the order of the values being reliable > (ie first is id, second is level, etc), then why use right and left id > at all? Or even level for that matter. A request containing only the > parent id would be faster for the connection, and the server-side > script would be able to generate the other information itself faster > than the browser. > > Blair > > On 10/29/06, *Stefan Petre* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Hi guys, > > Since soon I will implement the new sortables for trees I need your > opinion on how to implement serialization. I want to implement > more then > one version. > > So consider the next HTML > > <ul id="root"> > <li id="item_1"> > <ul> > <li id="item_21"></li> > <li id="item_34"></li> > </ul> > </li> > <li id="item_4"></li> > <li id="item_7"></li> > </ul> > > When you make your suggestion please use this as reference. You can > change the IDs if your situation requires it. > > *Method 1 > *I'm using nested sets to store hierarchical data in database so this > fits me: > item[1][]=1 - parent id > item[1][]=1 - level > item[1][]=1 - left id > item[1][]=6 - right id > item[21][]=1 - parent id > item[21][]=2 - level > item[21][]=2 - left id > item[21][]=3 - right id > item[34][]=1 - parent id > item[34][]=2 - level > item[34][]=4 - left id > item[34][]=5 - right id > item[4][]=4 - parent id > item[4][]=1 - level > item[4][]=7 - left id > item[4][]=8 - right id > item[7][]=7 - parent id > item[7][]=1 - level > item[7][]=9 - left id > item[7][]=10 - right id > > > I will use 4 days then release the plugin based on your feedback. Sure > later I can add more versions for serialization, but will be nice to > have them at the first release. > > Stefan > > _______________________________________________ > jQuery mailing list > [email protected] <mailto:[email protected]> > http://jquery.com/discuss/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > jQuery mailing list > [email protected] > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
