开发者

jQuery sortable events

Im using some jQuery sortables and I basically have two event开发者_StackOverflow handlers set up in the sortable init (receive and stop) The problem is, If the receive event fires then I don't want the stop event to fire. In other words, it's sending two ajax requests to my server when I only need one sent.

Is there some way to check if the receive event has already fired?

Thanks!


Sample code would help some, but you can use things like $(this).data({fired: false}); to store an attribute on the Sortable. Then, in your Receive and Stop methods do something like var props = $(this).data(); if (!props.fired) { // your execution code } as a way of detecting it. Inside of the execution block you'd include a line like $(this).data({fired: true}); to record that it's been sent.


Receive event will only fire if you're dragging an item from another list. In your "stop" handler you can check which list the item has come from and do not send ajax request if it's the same list

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜