Monday, March 19, 2012

How to move an item from a tree. - It has not to do with parent_id -

Hi.

taking

  element 1
  element 2
  element 3
  element 4
  element 5


When change of place the element 1 under element 5 I get the following.

  element 2
  element 3
  element 4
  element 5
  element 1

'element' => '1 ',
'parent' =>'',
'previous' => '5'

this means that the element 1 is preceded by the element 5.

- Clarify that if parent was defined to mean that the element 1 is a child of 5 element, but that's not the idea -

when the intention is to have an element is the child of another element. The behavior tree is responsible for updating the lft rght fields involved in defining parent_id

But if the intention is to have an element is preceded by another, such handling this scenario?


- With these data there are three scenarios:

'element' => '1 ',
'parent' =>'',
'previous' =>''

1) when the element 1 is a child of x element.

  element 2
  element 3 - x
  element 1
  element 4
  element 5

2) when the element is preceded by an element x

 
  element 2
  element 3
  element 4 - x
  element 1
  element 5

3) when the element 1 is a child of  x element  and is preceded by y element


  element 2 - x
  element 3 - y
  element 1
  element 4
  element 5


As noticed the first scenario is solved only with parent_id set, the behavior tree is responsible for updating the lft rght fields involved

The second and third stage are related and it is where my question.

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: