jQuery:Select2不禁用以前选择的值

时间:2013-08-20 00:39:13

标签: jquery ruby-on-rails jquery-select2

我有一个数组,我正在使用select2,但我希望多次选择相同的值。有没有办法启用此功能?我的代码如下:

#home.js
$(document).ready(function(){ 
    $("#productdropdown").select2({
        allowClear: true,
        placeholder: "Select a product..."
    });
});

然后在我看来

#index.html.erb
<%= form_tag manuals_path, method: :post, remote: true do %>
    <%= form_tag manuals_path, method: :post, remote: true do %>
    <%= select_tag :device, options_from_collection_for_select(@products, :id, :full_name), id: "productdropdown", multiple: true %>
    <%= submit_tag 'CREATE MYMANUAL', class: 'submit', id: "generate" %>
<% end %>

并在控制器中

  def index
    @products = Product.usable
  end

0 个答案:

没有答案