我正在使用 jquery ui 排序项目列表,如下所示:
%ul.nav.nav-tabs.nav-stacked#lineup{"data-update-url" => sort_lineups_url}
- @pieces.each_with_index do |piece, index|
= content_tag_for :li, piece do
= link_to "#{(index + 1).to_s + ' - ' + piece.name}", '#'
jQuery ->
$('#lineup').sortable(
axis: 'y'
update: ->
$.post($(this).data('update-url'), $(this).sortable('serialize'))
);
$( "#not-sortable" ).disableSelection();
我想要做的是始终禁止对@pieces 中的第一项进行排序。但是,我不知道如何使用 disableSelection() 来做到这一点。请帮忙。