我不能讓selectize-rails
與cocoon
一起工作。 (當增加+1考勤選擇不活躍時)。我看到了this的問題,但它給我帶來了無處不在。寶石用法:蠶繭+選號軌
我有什麼:
- Attendance model
- Event model
- Event has_many :attendances
我的JS:
$(document).ready(function(){
if ($('.selectize')){
$('.selectize').selectize({
sortField: 'text'
});
}
});
活動/ _form:
= simple_form_for @event do |f|
= f.button :submit, class: "btn btn-success add-button"
= f.input :starts_at, :minute_step => 15
#tasks
= f.simple_fields_for :attendances do |attendance|
= render 'attendance_fields', f: attendance
.links
%p
= link_to_add_association 'Add attendance', f, :attendances
_Attendance_fields:
.nested-fields
= f.select :guest_id, Guest.all.map{|c| [c, c.id]}, {},class: 'selectize'
= link_to_remove_association "Remove attendance", f
有什麼建議嗎?請幫助
您需要使用回調,如鏈接的答案中所示。你嘗試過嗎? – nathanvda
我對編程真的很陌生,也不太瞭解.js,但是,請給我一個關於怎麼做/看什麼的暗示? –