This project is read-only.

Attach another list

Jul 21, 2011 at 4:35 PM


Thanks for your great project.

How can I add another list to current dragsort function. I have some list that added to my page by user. and Items of that new list must be drag and drop able.

I used a same class name as list selector but it seems your code didn't work for new list.

another thing that I try is call the dragsort function again but it make some another problems to drag and drop functionality.

Is there any way to fix this problem?



Jul 23, 2011 at 3:10 AM

If you add a new list after dragsort has already been invoked you will need to call dragsort again to make the new list draggable. This is not the case for new items added to an existing list because the code is using the jquery live function. However, when you invoke dragsort again you don't want to include the original list as well because that will cause strange behaviour with that original list. So something list this should work:

//page load
$("#list1").dragsort({ ... });

//after new list added
$("#list2").dragsort({ ... });

If you want to be able to drag items between the two lists, then you will need to uninitialize dragsort from the original list first like so:

//page load
$("#list1".dragsort({ ... });

//after new list added
$("#list1, #list2").dragsort({ dragBetween: true, ... });
Hope that makes sense.