jsPlumb is drawing connections with incorrect offset when using jQuery Sortable - jquery-ui

In my project I'm using jQuery UI Sortable for reordering lists. You can find working example on http://jsfiddle.net/kerzad19/6/ It is possible to change order of blocks and items inside of blocks. This is working fine.
Now I want to draw connections between items, using jsPlumb. I know that jsPlumb requires position:absolute for draggable divs. But Sortable requires position:relative for reordering elements.
jsPlumb.recalculateOffsets($(ui.item).parents(".block"));
I tried to recalculate offsets, but it didn't help.
How can I fix offset for jsPlumb connection?

Related

Drag & Sort using Kendo UI

I want to implement similar functionality to the jQuery UI Draggable & Sortable, but using Kendo UI.
This should allow me to drag from a list of options and place them within a sortable list.
Here is the jQuery UI functionality: http://jqueryui.com/draggable/#sortable
I want 2 panels, one with items that can be dragged and the other containing the dragged items. The closest thing I could find on Kendo UI is: http://demos.telerik.com/kendo-ui/sortable/linkedlists, but the items in the first list (on the left) are sortable and this moves the item from the first list.
I have looked at all of the Kendo UI samples on Teleriks website, but I cannot see any examples of how to do this.
Update:
I am now part way there. I have 2 sortable lists and I have added code to stop the 'draggable' items from sortable. However, when I drag an item to the 'sortable' list, it disappears from the 'draggable' list.
Here's the code I'm using to stop the items being sortable:
start: function() {
$("#draggable li").each(function() {
$(this).removeClass("sortable");
});
Here is the fiddle: http://jsfiddle.net/kgjertsen/r4xmLevq/
Anyone able to tell me how to stop the items from disappearing?
After a lot of investigation, it turns out that you cannot link draggable with sortable, as you can with jQuery. You need to drop the item into the container, then sort it from its default place, which is at the bottom.
Telerik justify this with a statement saying that they cannot implement this behaviour as the controls cannot know about each other, as this is bad practice.
Personally, I think this is terrible and the functionality would be a great addition to the Kendo UI library.

Unbinding Masonry

Scenario:
I'm currently working with KnockoutJS, jQuery UI's sortable and Masonry. I use Knockout to display a list of cards, Masonry to arrange the cards properly, and sortable for sorting the cards.
The cards are of similar size, but I'll be introducing different sizes later on so I surely need Masonry to help me arrange them.
I'm using a customized bindingHandler function for the sortable so that when the user sorts the cards, the item's position gets updated in the knockout observableArray.
Problem:
Since the knockout sortable function removes the item from the last position and puts it back to a new position, Masonry messes up and somehow sortable also not functions properly. What I discovered was if I simply float left all the cards without using Masonry, sortable works fine.
I plan to undo Masonry at the start of the sortable, and put it back at the stop of the sortable. However I don't know how to unbind Masonry. Is there a way? Or at least a way to get it working.
Here's a prototype of what I'm trying to do:
http://jsbin.com/avujom/9/edit
you could use masonry's destroy to remove masonry. so it removes the Masonry functionality completely. This will return the element back to its pre-initialized state. and you could create masonry element when you needed by msnry = new Masonry( container );. Also you could use layout method.

jQuery UI draggable attached to sortable then dropping on droppable element not working

I am using jQuery UI 1.8.16 and am having trouble dragging a draggable item through a sortable list and then dropping it on a droppable item.
Here is an example of my problem
http://jsfiddle.net/9RURx/1/
The draggable item needs to be able to attach to the sortable list or be dropped on the droppable item.
Any suggestions?
Passing through sortable seems to make the list element lose its selector... not sure why, but the "accept" property doesn't work anymore
Quickest solution is to change accept to accept: ".ui-draggable"' see it working here: http://jsfiddle.net/9RURx/3/
now maybe you don't want to use the built in class. You can add a class to the LIs you want to be dropable and refer to them that way. Like so: http://jsfiddle.net/9RURx/4/

Is it possible to scroll jQuery UI accordion h3 overflow in a resizable div?

I'm attempting to use the accordion for a very long list of records, where the accordion is wrapped in a resizable div that is given a fixed amount of space on the page and you would scroll to find the h3's that are too high or too low to see. The problem that I'm having is that the headers always force the size of their div, so the "overflow: scroll" is essentially ignored as the h3's spill out of the explicitly sized parent.
We are using jQuery 1.6.2, and UI 1.8.16
Seems to be working fine for me: http://jsfiddle.net/GVFsn/
try applying style="clear:both" to the parent, that should work.
The accordion is floated content, and the browser does not know where it ends.
Either that or steal the .clearfix class from FaceBook

Sorting multiple items at the same time using jQuery UI

I'm trying to setup a way to sort multiple items at the same time using jQuery UI's Sortable plugin. I have come up with a partial solution, where the checked items go with the drag, but I can't get them all to move positions. Here is what I have: http://jsbin.com/ecela
What do I need to add to ensure the items move to their new location and get removed when dragging starts.
Also, I'm wondering if there is a way to use selectable and sortable together. I'm guessing not because they both require you to click on the items to select and drag/sort them.
There's a jQuery plugin for that: multisortable.
They have a jsfiddle example there too. You select items with shift-click or command-click, then drag them around.
Seems like a good starting off point, at least!

Resources