I'm looking to implement a web interface with a number of items which can be selected and dragged around to position them, either in groups or singly. Rather like the Windows Desktop, really.
We're using JQuery already, so additions to that would be first choice. JQuery UI Draggables and Selectables individually do much of what we want, but don't really work together to give the sort of effect we're looking for.
I am completely overwhelmed by the JQ plugin site (it's 'popular' algorithm doesn't seem very useful), and would welcome guidance as to the best way to avoid a lot of wheel-reinvention here, as I would guess that this metaphor has already been done.
I've made some modification to the answer given by Sinan Yasar. It's not perfect but it already behave much more like I would except.
One main addition is a click listener that calls the select.
You can see a complete working example here: http://jsfiddle.net/DXrNn/4/
There is also a jquery-ui plugin available that does just that: http://code.google.com/p/jqdragdropmultiselect/ The probleme is that it doesn't look maintained.
edit: if you define the "filter" option of the draggable, you will need to call selectable.refresh() before the selectable._mouseStop(null).
I also needed to do same thing, and i didn't want to use interface extension from eyecon.ro. After some research, I found Combining Selectables And Draggables Using jQuery UI. It is nicely told but to make the code snippets run you have to dig into it. I was able to make it work. I slightly changed it, this is my way to get it done. It needs modifications for using on production level, but i hope it helps.
CSS Styles to be able to see what's happening:
HTML Markup:
This question is relevant, but is old; so are the answers. Here's an updated version of @idFlood's jsfiddle, that works with jQuery 1.9.1 + jQueryUI 1.10.3:
I had a problem with the _mouseStop() call throwing an error, so I removed it; this means that the
ui-selecting
state no longer happens on click, but all other functionality remains intact.