0

I didn't quite get "disable" as that sounds more like setting the input type to disabled, and not the functionality. When i implemented it, thats pretty much what happened from my recollection.

For the time being, bouncing back and forth between Draggable and sortable, requires me to destroy the current and then reapply the opposing events.

I was thinking that you could do something like:

$item.draggable("pause"); or something so that way i wouldnt have to rebind events EVERY time i did this.

what i was doing was stuff like:

 //to toggle off drag and on sort.
 if($item.data("draggable")) $item.draggable("destroy");
 if(!$item.parent().data("sortable")) $item.parent().sortable();

Here is my example: http://jsfiddle.net/7k2HJ/

I just keep thinking that you should be able to pause draggable and sortable or something like this. If not its ok. I just had a thought. Maybe i was thinking about it wrong.

Thanks for input everyone

EDIT:

I can enable and disable the controls separately which is good, but if i disable the parent sortable object and try to reenable the draggable (on the children) it fails. there is no error, but the all controls are disabled and cant be re-enabled. There seems to be overlapping ground, possibly because the contain is "disabled"

Fallenreaper
  • 10,222
  • 12
  • 66
  • 129
  • 1
    I believe all jquery ui widgets have a disable - here's the one for draggable http://api.jqueryui.com/draggable/#method-disable – ntgCleaner Feb 04 '14 at 17:26
  • this does not really answer the question at hand. Example: I can enable and disable draggable, and sortable seperately, but if i say call disable on the parent sortable, then enable dragging, it does not work – Fallenreaper Feb 05 '14 at 15:23
  • Maybe it's because it takes itself out of being a DOM element. In this case, you may want to look into using `.on()`. Example here: http://stackoverflow.com/questions/15909041/jquery-how-to-use-live-on-draggable – ntgCleaner Feb 05 '14 at 16:01

1 Answers1

0

It is done by the disable property. See comments for an fiddle.

you can apply this to all ui objects. Disable will prevent the handlers from firing.

Fallenreaper
  • 10,222
  • 12
  • 66
  • 129