1

I have two lists. They are sortable but not connected (elements of list "one" cannot be mixed with elements of list "two")

I want elements of list "one" be droppable and elements of list "two" be draggable, because I want to drag and drop element of list "two" into list "one".

How should I do?

EDIT:

I tried to make the question as general as possible but maybe I should be more clear... sorry. Elements of list one are "categories" and they should be sortable. Elements of list two are "links" and should be sortable. A link belongs to only one category. I want to move a link from a categerory to another and I would love to use JQuery Ui.

Kara
  • 6,115
  • 16
  • 50
  • 57
GLF
  • 75
  • 8
  • Can elements of list one be dragged to list two, and list two to list one? or is that what you are trying to prevent. – Kevin B Jun 21 '12 at 15:40
  • I tried to make the question as general as possible but maybe I should be more clear. Elements of list one are "catergories" and they should be sortable. Elements of list two are "links" and should be sortable. A link belongs to only one category. I want to move a link from a categerory to another and i would love to use JQuery Ui. I hope that now my problem is clearer. – GLF Jun 22 '12 at 10:47

1 Answers1

0

If I understand your question correctly, you do not have to use draggable and droppable in conjunction with sortable in your case.

Sortable connections are inherently one-way, so you only have to connect the second list to the first, and avoid connecting the first to the second:

<ul id="first">
    <!-- ... -->
</ul>

<ul id="second">
    <!-- ... -->
</ul>

$("#first").sortable();
$("#second").sortable({
    connectWith: "#first"
});
Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
  • Hi Frederic, It's been long time since you wrote this answer. I have to say that you answer did not solve my problem but it actually solved my question :). that's because I did not wrote the question properly. – GLF Nov 06 '12 at 09:02