nestedSortable icon indicating copy to clipboard operation
nestedSortable copied to clipboard

draggable connectToSortable

Open pyalot opened this issue 12 years ago • 6 comments

I'd like to connect draggables to the nestedSortable. There is a draggable option for that http://api.jqueryui.com/draggable/#option-connectToSortable

That option doesn't work currently.

pyalot avatar Apr 20 '13 13:04 pyalot

Last time I checked it was a problem with Draggable itself, nothing I can do with the plugin :/

mjsarfatti avatar Apr 23 '13 14:04 mjsarfatti

Can you describe your findings as to why it doesn't work? I'll need to get this fixed eventually, and I'm wondering if a workaround is possible, or if I have to submit a bug ticket for jQuery UI.

pyalot avatar Apr 23 '13 14:04 pyalot

Same here, its so valuable to create a menu from a list of pages.

Is there maybe another route:

  1. Create 2 nestedSortables.
  2. Make one only 1 level, and let that one create copies, so original stays.

martijnmegens avatar Apr 24 '13 10:04 martijnmegens

It was a problem with the events triggered on start. NestedSortable wasn't able to properly receive the element. I really don't remember the details though :| Things might have changed now though...

mjsarfatti avatar Jun 10 '13 08:06 mjsarfatti

If you're interested in doing this, take a look at the definition of connectToSortable here: https://code.google.com/p/jquery-ui/source/browse/trunk/ui/ui.draggable.js?r=3103#452 As you can see, it's reading the data property "sortable" , which is why it isn't compatible. nestedSortable instead uses the property "mjsNestedSortable" (may be different depending on the version you're using)

You can basically copy this whole plugin.add block, rename connectToSortable to connectToNestedSortable, and alter it to check for the correct data attribute.. then you've successfully extended draggables to support nestedSortable. Just had to do it myself and it's working pretty well.

nkpz avatar Nov 20 '13 23:11 nkpz

Would you be so kind as to provide us this working example nnjpp? I understand what you're explaining but I just can't seem to get it working from my side. Alternatively, is there a more concrete fix for this?

marcdebeer avatar Jul 28 '14 14:07 marcdebeer