I have this data in the database with tree behavior attached to the model. So in the first example I would like to reorder the tree as follows: Bear - Emo - Toivo - Inlove - Broakenheart. This simple one move i can do with moveUp or moveDown. But more often I need to move the items more complexly for example: Broakenheart - Emo - Bear - Inlove - Toivo. I guess that if I insert one more column with the index of this sorting , it can be done , but can it be done without this extra column?
+----+-----+------+------------+ | id | lft | rght | title | +----+-----+------+------------+ | 4 | 1 | 2 |Bear | | 5 | 3 | 4 |Emo | | 6 | 5 | 6 |Toivo | | 8 | 7 | 8 |Brokenheart | | 9 | 9 | 10 |Inlove | +----+-----+------+------------+ On Oct 15, 10:56 am, Jeremy Burns | Class Outfit <[email protected]> wrote: > It would help if you can paste a real example of the array before and after > the sort so we all know what you want to achieve. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 15 Oct 2011, at 08:34, WebbedIT wrote: > > > > > > > > > This array does not look like a tree? A MPTT tree should have a lot > > more values that this, mainly including parent_id, lft and rght. > > > HTH, Paul > > > On Oct 15, 12:29 am, "Constantin.FF" <[email protected]> wrote: > >> I need to reorder a part of my tree. > >> I have given values for example: > >> Array > >> ( > >> [0] => 4 > >> [1] => 5 > >> [2] => 6 > >> [3] => 9 > >> [4] => 8 > >> ) > >> where for example 0,1,2,3,4 is the new order of the relevant item ids > >> I have read all the documentation according the reorder (which is not > >> much), and also browsed the web but jut nothing even similar to this. > >> Please any suggestions. Thanks > > > -- > > Our newest site for the community: CakePHP Video > > Tutorialshttp://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > [email protected] For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
