我想问一下如何使用materializecss模态将选择表单添加到导轨中。
这是我的_form.html.erb
<div class="row" id="inStaff">
<div class="input-field col s4">
<div class="control-group">
<%= form.label :staff, class: 'control-label' %>
<div class="controls">
<%= form.select(:staff, options_for_select([['1', '1'],['2', '2'],['3', '3']]),{include_blank: true})%>
</div>
</div>
</div>
</div>
<div class="row" id="inCustomer">
<div class="input-field col s4">
<div class="control-group">
<%= form.label :customer, class: 'control-label' %>
<div class="controls">
<%= form.select(:customer, options_for_select([['4', '4'],['5', '5'],['6', '6']]),{include_blank: true})%>
</div>
</div>
</div>
</div>
我的form.js
$(document).ready(function(){
$('select').formSelect();
});
答案 0 :(得分:0)
模式打开时,您可能需要初始化选择器。
$('.modal').modal({
onOpenStart: function(modal, trigger) {
$('select').formSelect()
}
});