CodeKnack
CodeKnack

Reputation: 21

nestedSortable connected sortable

Is it possible to connect two nested sortable list?

Some things I've tried.

First list is a sortable list and the second is a nestedSortable list, what happens is I can drag items to the nested list as long as the nestedSortable is not set to connect with the sortable list. If I set the nestedSortable list to connect with the sortable list the nestedSortable list stops working.

Secondly. If both list are set to nestedSortable the browser crashes as soon as you try to drag an item.

I would like to be able to drag items from the nestedSortable list to the sortable list or use two nestedSortable list.

Is this possible? Thanks

Here is the example code:

(function() {
        $( ".sortablelistone" ).sortable({
            connectWith: ".sortable"
        }).disableSelection();
    });

$(function() {
        $( ".sortablelisttwo" ).nestedSortable({
            connectWith: ".sortable"
        }).disableSelection();
    });

<ol class="sortablelistone sortable">
<li>Link One</li>
<li>Link Two</li>
</ol>

<ol class="sortablelisttwo sortable">
<li>Link One</li>
<li>Link Two</li>
</ol>

Upvotes: 1

Views: 958

Answers (1)

Cholesterol
Cholesterol

Reputation: 177

Yes, it's possible to connect 2 lists using the nestedSortable plugin. Try something like this:

(function() {
      $( ".sortablelistone, .sortablelisttwo" ).nestedSortable({
            connectWith: ".sortable"
            /* other settings */
      }).disableSelection();
});

Upvotes: 2

Related Questions