views:

115

answers:

1

Hello,

I'm trying to create an interface similar to IGoogle, where I would have different DIVs populated with links (UL/LI - list items) and user could drag the items from one div to another.

To be more precise, I want to have one DIV that has all the available list items and other DIVs that are user defined (user drags items from the first DIV to other ones).

When user moves the item to a receiving DIV, I want to check if this list item already exists in the receiving DIV. Is there some kind of event in Jquery Sortable that is executed before the item is received? The only event that seems suitable (receive) is fired when the item is already inserted in the new DIV. I could remove the item after it's already inserted, but this is in my opinion an ugly solution.

A: 

The beforeStop ( http://jqueryui.com/demos/sortable/#event-beforeStop ) event should be what you are hunting for as it fires off after sorting has ended and before the helper/item is placed in the new location. In that event, you can look at ui.item and to determine if it already exists.

borkweb