Sortable stealing from Droppable?

Sortable stealing from Droppable?

I'm creating a system where users can reorder a list of their sites, but also throw them into a "bin" if they don't want it on the main list. These are just two sortables, it works fine, saves and loads from database, the works.

However, I want to have the bin be shrinkable. No problem, the bin toggles open and closed with a click. But while the bin is closed, I can't drop stuff onto that list, because the list is hidden. No problem, I'll just make the bin label a drop target, and anything dropped onto it will just append to the (now hidden) list.

This is the code I'm using for that:

  1.  $("#bin_LABEL").droppable({
  2.       drop: function (event, ui) {
  3.             // Drop it into the list rather than on ourselves
  4.             $("#bin_CONTENT").append(ui.draggable);
  5.             $("#bin_CONTENT").append("TEST TEXT");
  6.       }
  7. });

When I drop onto the label, I do get the text "TEST TEXT" being added, but the dragged item returns back to the original list instead of dropping.


Is there some kind of event override I need to do to tell sortable that this was a legal move and it should let go of the object? It feels like this should be really simple, and I'm just missing something basic.


Advice would be appreciated!