I am using this method http://jqueryui.com/demos/sortable/#connect-lists to connect two lists that i have. I want to be able to drag from list A to list B but when the item is dropped, i need to keep the original one still in list A. I checked the options and events but I believe there is nothing like that. Any approaches?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- how to split a list into a given number of sub-lis
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
I know this is old, but I could not get Erez's answer to work, and Thorsten's didn't cut it for the project I need it for. This seems to work exactly how I need:
When using Erez's solution but for connecting 2 sortable portlets (basis was the portlet example code from http://jqueryui.com/sortable/#portlets), the toggle on the clone would not work. I added the following line before 'return li.clone();' to make it work.
This took me a while to figure out so I hope it helps someone.
The answer of abuser2582707 works best for me. Except one error: You need to change the return to
So it should be:
Erez' solution works for me, but I found its lack of encapsulation frustrating. I'd propose using the following solution to avoid global variable usage:
Here's a jsFiddle: http://jsfiddle.net/v265q/190/
For a beginning, have a look at this, and read @Erez answer, too.