Stefan, I have been silently admiring (and using) your work for a time and have to say that it rocks! I will send you a link to a demo as soon as I finish what I am working on. For the time being, I am actually quite interested in the nested sortables functionality you have posted about. I have played around with the early version example you have provided and have found a thing that probably needs to be taken care of:

 

There is no way to drop an item A into another item B if item B does not already have some children. That means that, right now, if all items are moved one by one to, say, the same level as option 1, the sortable list will become a flat list and there will be no way to create a nested list again.

 

I can think of two solutions to this shortcoming:

 

1) Put a <ul class="sortConatiner"> inside all items (even the ones that have no children). You will probably need to make the <ul class="sortConatiner"> have a small height so that empty <ul class="sortConatiner"> accept dropped items. The problem with this approach is that the height needed in empty <ul class="sortConatiner"> might make the nested list look slightly weird. Also, since the <ul class="sortConatiner"> will be shown just bellow its parent item, it might be difficult for the user to differentiate between an item being dropped into another item and an item being dropped bellow another item.

 

2) Detect the exact location of the dragged item with respect to the hovered item:

 

If the dropped item is near the top of the hovered item, show a horizontal line above the hovered item and, if the dragged item is dropped, place the dropped item as an elder brother of the hovered item,

If the dropped item is around the middle of the hovered item, temporarily color the background of the hovered item and, if the dragged item is dropped, find or create an inner <ul class="sortConatiner"> in the hovered item and put the dropped item into it.

If the dropped item is near the bottom of the hovered item, show a horizontal line bellow the hovered item and, if the dragged item is dropped, place the dropped item as a younger brother of the hovered item.

 

I hope my explanations are not too confusing! Thanks for your efforts,

 

Norbert.

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to