views:

2868

answers:

8

Hello,

I'm looking for the best JavaScript library for handling complicated drag and drop operations. I'm interested in implementing a grid-based inventory system for my own Web 2.0-style RPG, like Baldur's Gate or Neverwinter Nights (with variable-sized but rectangular items).

Lots of Javascript frameworks seem to have drag & drop implementations, so I'm looking for recommendations on which one is superior from someone who has experience using these features.

+13  A: 

I would recommend jQuery UI, which supports drag-and-drop through the Draggable and Droppable interactions.

kgiannakakis
+2  A: 

Beside jQuery, script.aculo.us is a good ones with a lot of options.

Peter
+1  A: 

I'm not sure If all the JavaScript libraries suffer from the problem I'm about to describe, but it's worth checking before you get too far into the development process.

I used MooTools once for a drag and drop interface. I found that if you have more than just a few droppables things become a little slow.
The reason is that for each mousemove event the droppables are polled for their current coordinates. This is necessary because the DOM may have moved due to scrolling. I solved the problem by tweaking the Drag.Move object to only poll every 5 pixels.

I've since made other Drag and Drop interfaces and have used my own home rolled solution which only polls for the droppables' positions at the start of drag and on scroll events. This solution is lightning fast because I include the functionality I actually need.
A common gripe with libraries is that they do everything but only fairly well

meouw
I built prototypes with both JQuery and MooTools (based on other recommendations). I used a 10x10 grid (100 droppables). JQuery performed fine, a little sluggish but OK, while MooTools exhibited the slowdown you describe and was essentially unusable. So JQuery is clearly better for many droppables.
kquinn
+1  A: 

Ext JS is a cross-browser JavaScript library for building rich internet applications.

  • High performance, customizable UI widgets
  • Well designed, documented and extensible Component model
  • Commercial and Open Source licenses available
Karsten
A: 

I have tried all the libraries mentioned above, but for performance, Rico is the BEST.

Kirtan
Rico is really, really, old.
Sembiance
+2  A: 

I used YUI 2 for all the very complicated drag and drop conditions used on http://worldofsolitaire.com

YUI gave me the flexibility to handle a large number of drag and drop targets.

Sembiance
Yes, it is, but perf-wise, I found it much better than Prototype/JQuery.
Kirtan
With a little tweaks for new browsers, you can make it work in a much better way than Prototype/JQuery. But I'll surely check out YUI. Thanks.
Kirtan
Really good. Congratulations
Arthur Ronald F D Garcia
A: 

Rico just supports best for IE not Firefox and I don't consider it as the good solution for my problem ... :(

A: 

Hi,

JQuery drag-and-drop has some bugs. YUI provides a powerful API and is more stable than JQuery drag-and-drop (There is some cases where JQuery does not work as expected). I use successfully BOTH API. When JQuery does not solves my problem, then i use YUI and vice-versa. Both works together. So be open minded when using a widget library.

regards,

Arthur Ronald F D Garcia