2014-09-26 49 views
0

這是我的問題:我有這樣的:如何使用javaScript/jQuery刪除事件「可選擇」的jQueryUI?

$("table").selectable({ 
    filter: "td",  
    start: function() 
    { 

所以,每一個tdtr是 「可選」,但是,我做了這樣的事情:

selecting: function(){ 
if(posicionInicial.posy == arregloObjetos[1].posy) //Esta seleccionando por columnas 
       { 
        if(direccionSeleccion.posy != posicionInicial.posy) 
        {        
         $(".ui-selectee").unbind();  
        }       
       } 

}

我想「解除」不在同一行或列中的其他「td」的「可選」事件...(請記住,我需要從其內部切割事件.. )

但我試過用jqueryUI(「.ui-selectee」)創建的類的「unbind」...但它不起作用...

請幫忙嗎?

謝謝

+0

這將幫助你編寫代碼的英文,這是很難理解的代碼時,無功不理解我們。 現在對於你的問題,你確定調用了unbind()方法嗎?嘗試使用您的導航器調試器。 – 2014-10-25 01:58:26

回答

0

試試這個。

取消選項已添加。

此取消選項決定是否取消或不

$("table").selectable({ 
    filter: "td",  
    cancel: ".unbind", 
    selected: function(){ 
     // [some td that you want unbind].addClass("unbind"); 
    } 
}); 
+0

我試過了,但我完全忘了一些事情:如果我放在那裏,生活在jQuery UI的「可選擇」的「選擇」事件中......所以我需要從事件內部「結束它」 – 2014-09-26 15:51:31

+0

檢查更新的答案將幫助你 – easywaru 2014-09-26 16:45:43

+0

我試過這個,但它不工作只是「addClass('unbind')」,所以我做了:「.removeClass()」和「addClass()」,它終於奏效。謝謝! – 2014-09-30 22:25:02

0

怎麼樣只應用selectable到第一行?

$("table tr:first").selectable({