views:

20

answers:

1

Hello,

I'm using the JQUERY-UI draggable plugin. As a setting, when the Draggable is done, using the STOP setting I run a function to seralize a list of LIs to get their order in terms of their IDs.

For example, if I have an UL, with a list of LIs with the following IDs: 1,2,3,4,5

If I then move 5, between 2&3, the seralize is returning: 1,2,5,3,4,5

Which makes me think that the JQUERY UI-Draggable STOP is running before the page is finished rendering, or the DOM isn't update?

Any ideas on how I can fix this from happening. Is there something I can do in my Seralize funtion to say, wait till JQUERY animations are all done, or stop all that are going on to ensure the DOM is accurate?

Thanks

+1  A: 

Try the update event instead of the stop event...

This event is triggered when the user stopped sorting and the DOM position has changed.

great_llama
I'm not seeing an update event? http://jqueryui.com/demos/draggable/
AnApprentice
I assumed you were using the Sortable plugin... it's the one with the update event (and the one I'd use if I were doing reordering within lists)
great_llama