[ 3 posts ]

ztolley

  • Joined: Sun Nov 01, 2009 3:03 am
  • Posts: 17
  • Offline
  • Profile

Dragging cloned nodes into sortable lists

Post Posted: Fri Sep 24, 2010 7:36 am
+0-
I'm trying to do something and am sooo close.

I want to have a pallet of things and be able to drag from that pallete into a list.

Now here's the tricky thing. When I drag out of the pallet use the option to clone the node, as I might want to drag the same control in the pallet into the list in multiple places.

The list that I'm dragging into is sortable, so the user can re-arrange things.

I've managed to create the 2 things seperately, dragging from the toolbox and the sorting in the list but what I would really like is when the item is dragged over it makes a space for it so you can insert it into the desired point in the list.

The examples for dragging from one sortable list to another come very close, the problem is that the items dragged are not cloned, so they are removed from the original location.

Has anyone seen an example of what I'm trying to do, or is there a sortable list option I haven't seen that says not only can you drag from list a to list b, but we'll clone the node too.

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: Dragging cloned nodes into sortable lists

Post Posted: Fri Sep 24, 2010 7:46 am
+0-
You can set the "moveType" config option on the Sortable to "copy":
http://developer.yahoo.com/yui/3/api/Pl ... g_moveType

The values are: insert, swap, move, copy. It defaults to: insert.

ztolley

  • Joined: Sun Nov 01, 2009 3:03 am
  • Posts: 17
  • Offline
  • Profile

Re: Dragging cloned nodes into sortable lists

Post Posted: Fri Sep 24, 2010 12:08 pm
+0-
It's close, real close.

The bahaviour is a bit odd though. When you drag something from the toolbox onto the main list if you decide not to and mouse away from it it still adds it, and opacity acts a little strange.

Starting to think I'll have to stick with the regular drag and drop onto a sorted list but hook up some sort of event handling so that when the mouse is over a list element it detects its its in its upper or lower half and put in a ghost placement div between them.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum