Log message #3148258

# At Username Text
# Jan 28th 2014, 16:32 biesbjerg I'm doing it the easy way for now by only making it possible to reorder within the same parent
# Jan 28th 2014, 16:32 biesbjerg ah, yes
# Jan 28th 2014, 16:32 dereuromark by moving a record somewhere else it might have a different parent_id
# Jan 28th 2014, 16:31 biesbjerg don't understand what you mean by "first modify parent_id" though
# Jan 28th 2014, 16:31 biesbjerg dereuromark: might also work
# Jan 28th 2014, 16:29 dereuromark you first modify parent_id and afterwards move it up/down until the correct position is reached
# Jan 28th 2014, 16:29 biesbjerg jose_zap :)
# Jan 28th 2014, 16:29 dereuromark biesbjerg: bad.. calc the diff to the current structure and then modify accordingly
# Jan 28th 2014, 16:28 biesbjerg gives me*
# Jan 28th 2014, 16:28 biesbjerg dereuromark: jqueryUI sortable gives be an array of id's in the new order
# Jan 28th 2014, 16:27 jose_zap let me suggest then that you read it again, http://www.sitepoint.com/hierarchical-data-database-2/
# Jan 28th 2014, 16:27 dereuromark biesbjerg: you can leverage the trees behavior up/down to make it work
# Jan 28th 2014, 16:27 biesbjerg Got an idea, maybe I can use a position field and reorder using TreeBehavior::reorder() according to position :)
# Jan 28th 2014, 16:26 biesbjerg since it uses lft/rght values
# Jan 28th 2014, 16:25 biesbjerg which is why I don't understand your suggestion to use a custom field (e.g. position INT) and still have TreeBehavior return data in tree-structure in the correct order ;)
# Jan 28th 2014, 16:24 biesbjerg I already knows how the hierachy and lft/rght works and is calculated
# Jan 28th 2014, 16:24 jose_zap also it will explain why you cannot do that
# Jan 28th 2014, 16:24 jose_zap I recommend you read the theory be hid MPPT, once you understand how it works it makes you think of better ways to access your data
# Jan 28th 2014, 16:23 jose_zap P
# Jan 28th 2014, 16:23 jose_zap ehmm. no
# Jan 28th 2014, 16:22 biesbjerg If I don't I will get wrong order when using TreeBehaviors methods
# Jan 28th 2014, 16:22 biesbjerg Don't know why, but seems wrong to me to add another field. Wouldn't it be better to reorder using lft/rght values?
# Jan 28th 2014, 16:21 jose_zap you could add other column to order within levels, though
# Jan 28th 2014, 16:21 jose_zap that means it orders following the outer shape of the tree from left to right
# Jan 28th 2014, 16:20 jose_zap trees can be ordered in different ways, the order that tree behaviour uses naturally is pre-order
# Jan 28th 2014, 16:20 jose_zap one think is tree hierarchy, another is position in the tree
# Jan 28th 2014, 16:19 biesbjerg jose_zap: Hmm.. parent_id only says who the parent is (if any), not the position of the node
# Jan 28th 2014, 16:18 jose_zap so if you change the parent_id the behaviour will do the rest
# Jan 28th 2014, 16:17 jose_zap biesbjerg: those columns are only dependent on the parent_id
# Jan 28th 2014, 16:11 biesbjerg Anyone here that ahve worked with jQueryUI sortable and TreeBehavior? More specifically how to update the lft/rght values according to order set with sortable?
# Jan 28th 2014, 15:45 lawrence thanks :-)
# Jan 28th 2014, 15:40 jose_zap lawrence: you will need this in your database.php https://gist.github.com/lorenzo/8669768
# Jan 28th 2014, 15:39 lawrence sure, thank you!
# Jan 28th 2014, 15:38 jose_zap let me know if you have question on how that works
# Jan 28th 2014, 15:38 jose_zap but hopefully that would be trivial
# Jan 28th 2014, 15:38 jose_zap lawrence: it contains all the logic you need to deal with paypal ipn. The code works with mongo db, so there is some work to do to port it to work with normal cakephp models
# Jan 28th 2014, 15:37 jose_zap lawrence: I hope this helps https://github.com/lorenzo/cakephp-paypal-ipn
# Jan 28th 2014, 15:34 jose_zap actually, I'm going to put the code on github, just a moment
# Jan 28th 2014, 15:33 jose_zap lawrence: can you pm me your email?
# Jan 28th 2014, 15:32 lawrence oooh that would be wonderful, thank you!
# Jan 28th 2014, 15:31 jose_zap lawrence: give me 5 minutes, I will be able to help you with some code