我想禁用source_element的排序.我可以这样做吗?
function dropMembers(){
$("ul.present").sortable({
connectWith: 'ul',
containment: 'window',
items: 'li:not(.notSortable)'
});
$("ul.usrlist").sortable({
connectWith: 'ul',
dropOnEmpty: true,
containment: 'window',
update: function(event, ui) {
//Element ready to be dropped to new place
source_element = $(ui.item).attr("id");
alert(source_element);
source_element1=source_element.split('_');
alert(source_element1);
if(source_element[1]==GLOBAL_MY_ID){
// I want to disable sorting of source_element here
}
// here is your selected item }
}
// sort: function(event, ui) {
// var usr_result=$("ul.usr").sortable('toArray');
// //alert(ui.sortable);
// }
});
$("#MAIN_USER_LIST,#USER_PRESENT_LIST").disableSelection();
}
Run Code Online (Sandbox Code Playgroud)
在你的示例中,我的代码是我禁用排序使用的主流答案
$(ui.sender).sortable( '取消');
但我认为,对于禁用移动更好的是阻止开始事件中的移动并将其禁用为:
$(本).sortable( '取消');
PS:您使用我的代码创建了新问题而没有将我的答案标记为已接受.不明白你的行为..
| 归档时间: |
|
| 查看次数: |
13158 次 |
| 最近记录: |