2013-03-05 63 views
7

我拖着禁用jQuery的排序名單上,但不知道如何啓用它回來了,可有人點我的方向請jQuery的排序使

$(".anotherClass").sortable('disable'); //it disables it 

我似乎無法找到任何文件。

這個問題在這裏說的使能輸入,但它不工作

$("#wantedItems").sortable({ 
    receive: function (event, ui) { 
     //enable the input here which input ??????????????????????????????? 
    } 
}); 
+0

只是爲了澄清,要啓用'$( 「anotherClass」)。排序()'? – Dom 2013-03-05 14:30:58

回答

1
simply write..... 

$(".anotherClass").sortable() 
0

啓用()

啓用排序功能。

  • 此方法不接受任何參數。

代碼示例:
調用啓用方法:

$(".selector").sortable("enable"); 

鏈接:http://api.jqueryui.com/sortable/#method-enable

+0

似乎沒有工作。如果您在啓用/禁用之間切換,它將不起作用。 – lorddarq 2014-05-22 15:40:51

0

要再次啓用sortable()可以使用

$(".anotherClass").sortable("enable");

要切換啓用/禁用一個按鈕的點擊ID爲toggleButton

$('#toggleButton').click(function() { 
    //check if sortable() is enabled and change and change state accordingly 
    // Getter 
    var disabled = $(".anotherClass").sortable("option", "disabled"); 
    if (disabled) { 
    $(".anotherClass").sortable("enable"); 
    } 
    else { 
    $(".anotherClass").sortable("disable"); 
    } 
});