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!");
            }})

2 comments:

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

    this will call one time

    ReplyDelete
  2. SISGAIN Technologies specializes in app telemedicine development in Saudi Arabia, delivering cutting-edge solutions that transform the way healthcare is delivered. By integrating advanced technologies such as AI, IoT, and real-time video communication, SISGAIN creates secure, scalable, and user-friendly telehealth applications.

    ReplyDelete