[ 6 posts ]

fermdp

  • Joined: Tue Sep 15, 2009 2:05 pm
  • Posts: 3
  • Offline
  • Profile

Multiple Drag and Drop is possible?

Post Posted: Tue Sep 15, 2009 2:13 pm
+0-
Hi People,

Just wondering if any of you have ever come across of Drag and Drop
examples that will allow one to drag and drop multiple items between
lists? That is, users would be able to use the "Shift" or "Ctrl"
buttons to select multiple items from LIST 1 and drag them to LIST 2 in
one go.

I've already have the code to drag and drop between lists but for 1
item at a time. The only method to move multiple items between lists
in one go that I'm aware of is to use <select multiple>, but with this
approach I loose the drag and drop feature and will be stuck with
buttons.

If any of you could help I'll really appreciate it.


Thank you

PD: Sorry for my bad english.
Two sites with similar examples

http://forkjavascript.org/drag/multiple

http://peter.michaux.ca/examples/yui-mu ... proxy.html

fermdp

  • Joined: Tue Sep 15, 2009 2:05 pm
  • Posts: 3
  • Offline
  • Profile

Re: Multiple Drag and Drop is possible?

Post Posted: Sat Sep 19, 2009 3:44 pm
+0-
Any idea??? Thanks!

Donald Fincher

YUI Contributor

  • Username: Floydian
  • Joined: Sat Jan 24, 2009 2:27 pm
  • Posts: 233
  • Location: Ohio
  • GitHub: floydian
  • Gists: floydian
  • IRC: floydian2
  • YUI Developer
  • Offline
  • Profile

Re: Multiple Drag and Drop is possible?

Post Posted: Sat Sep 19, 2009 4:13 pm
+0-
Can't say that I have, until viewing the examples you posted.

It seems to me that those two examples put forth some good ideas on how to implement this. I'd say that using the alt key like in the first example might be less intuitive than using the control key like the second example.

I would probably do this using a proxy drag and drop as per the second example. You should be able to tell which items are selected once you get the selection mechanism down. Then it should be a simple matter of implementing a valid drop function and moving the selected elements.

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: Multiple Drag and Drop is possible?

Post Posted: Sat Sep 19, 2009 8:01 pm
+0-
This is one of my oldest example of doing that:

http://blog.davglass.com/files/yui/dd34/

Bill Gao

  • Username: viruschidai
  • Joined: Tue Aug 11, 2009 3:14 pm
  • Posts: 15
  • IRC: Bill
  • Offline
  • Profile

Re: Multiple Drag and Drop is possible?

Post Posted: Sun Sep 20, 2009 9:08 pm
+0-
Hi,

It's entirely possible. I did exactly what you are looking for in one of my project.
My approach is to create a class extends from DDProxy. Check whether ctrl or shift is pressed in onMouseDown method. Use a variable for each list to track the last selected list item and an array for each list to record all the selected items.
If ctrl is pressed, the target list item is added into the selected items array. If shift is pressed, all the list items between the lastselectedItem and the target list item are added into the selected item array. If no shift or ctrl pressed, clean the array and add the target item to the array. Hide all the selected items in the startDrag function and insert all the selected items into the target list in the endDrag function.

It may be not a perfect solution. But it worked fine.
regards,
Bill

Atanu Ghosh

  • Username: AtanuGhosh
  • Joined: Wed Nov 24, 2010 8:35 pm
  • Posts: 2
  • Offline
  • Profile

Re: Multiple Drag and Drop is possible?

Post Posted: Thu Nov 25, 2010 11:26 pm
+0-
Please paste the code for multiple row drag and drop on table...
Thanks in advance...
  [ 6 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