Friday, July 29, 2011

JQuery sortable draggable bug.

JQuery sortable Update event calls twice when you bind it to class, not to id and when you drag item to other connectable block.
Jquery
$(".MyClass1, .MyClass2").sortable({
    connectWith: ".connectedSortable",
    update: function (event, ui) {
                alert("twice!");
            }})


Very simple solution is to change event "update" to "stop":

Jquery
$(".MyClass1, .MyClass2").sortable({
    connectWith: ".connectedSortable",
    stop: function (event, ui) {
                alert("once!");
            }})

1 comment:

  1. you can use in update method
    if(ui.sender){
    // your code goes here !
    }

    this will call one time

    ReplyDelete