I have a item model and each item can have many items. This can be many levels deep.
I have this jsfiddle http://jsfiddle.net/rmossuk/xmcBf/3/
how do I change this to be able to have multiple levels of items and also how do I loop down each level to display them ?
I also need be able to order each items children and store that order to persist to server.
please can anyone show me how you can do this ?
UPDATE:
I have now managed to implement the Items can be many levels deep bit of this problem see here http://jsfiddle.net/rmossuk/fBmmS/3/
But i need a way to state the order of each items children and to display them in that order. At the moment it just displays the children items from the itemIds array but this is only used for association purposes and i cant change this to re-order can i ??
Anyone know how to do this ?
Thanks a lot
rick
In the views, use a
sortedItemscomputed property, defined as follow:.JS
See a full working solution here: http://jsfiddle.net/MikeAski/K286Q/3/
EDIT
According to your request, here is another solution, keeping the sorted ids inside the parent (to minimize updates & indexes management): http://jsfiddle.net/MikeAski/K286Q/12/
JS
A little bit more complicated, nevertheless…