0

我在页面上有 twitter bootstrap 下拉列表

.btn-group
    %a.btn.dropdown-toggle{"data-toggle"=>"dropdown", href: "#"}
      Test
      %span.caret
    %ul.dropdown-menu#dropdown-menu-test1
      - if data.any?
        - data.each do |account|
          %li
            %label.checkbox
              %input{ type: :checkbox, value: some_value, name: "test", checked: some_condition}some data

我工作得很好,但我想将其转换为https://github.com/davidstutz/bootstrap-multiselect。为此,我必须替换%ul - %li%select - %option所做的。

  %select{class: "multiselect", multiple:"multiple", id: "multiselect-test", name: "multiselect-test-name"}
    %option
      test1
    %option
      test2

但事实证明,无法检查页面加载的某些选项。还有更多,params["multiselect-test-name"]是零。

那么我该如何处理这两个问题:缺乏对页面加载进行某些选项检查的能力(取决于some_condition)和缺乏params["multiselect-test-name"]

4

1 回答 1

0

你应该尝试这样的选项options_for_select(["test1", "test2", "test3"])

例如:

%select{class: "multiselect", multiple:true, id: "multiselect-test", name: "multiselect-test-name", options_for_select(["test1", "test2", "test3"])}

它会为你工作 inshaAllah..

于 2013-06-15T09:40:54.267 回答