Toggling Dragsort functionality (on/off)

Dec 19, 2009 at 11:36 PM

Hello, I had another question about a function which may or may not already be possible.

I am using the Dragsort functionality, in combination with CKEditor, to create a sortable, edit-in-place CMS for my website (I'm using CKEditor to edit the items' content on double-click). When I am in "edit mode," I would like to disable the dragsort functionality, because I think it is interfering with some of CKEditor's functionality. When the user clicks anywhere outside of the editor, it closes the editor and returns to a normal display (dragsort should then be re-enabled).

I don't know if Dragsort functionality is already able to be terminated dynamically, but it would certainly be the answer to my prayers.

Thanks again, and keep up the great work!

Coordinator
Dec 21, 2009 at 5:19 AM

I haven't got anything builtin but to disable dragsort you can use:

$("#list1").unbind("mousedown").find(dragSelector).css("cursor", "auto");
And to re-enable call the dragsort initialization code again.

May 14, 2010 at 5:14 PM

I am doing this in my dragEnd function, right before I send an ajax request (I want to disable sorting while I'm saving the list).  However, the placeholder isn't getting removed.  Any ideas on how to fix?

Coordinator
May 17, 2010 at 6:28 AM

In the code provided you need to replace dragSelector with the value you specified when initializing dragsort, if you didn't specify a value then use the default like so:

$("#list1").unbind("mousedown").find("LI").css("cursor", "auto");
If that doesn't help do you want to provide a example of your code (if the placeholder didn't get removed then it's likely an error was thrown so it may help checking the error console).

May 17, 2010 at 11:31 AM

Thanks, I should have actually read the code I was copying in.