-1
它不工作,選擇2不給我任何價值,像帶來的價值,我是新來的編程選擇2紅寶石,我想學到很多東西,謝謝爲幫助
application.css.scss
*= require toastr
*= require jquery-ui
*= require select2
*= require select2-bootstrap
*= require_tree .
*= require_self
*/
@import 'bootstrap-sprockets';
@import 'bootstrap';
@import 'bootstrap-datetimepicker';
@import "select2";
@import "select2-bootstrap";
@import "font-awesome-sprockets";
@import "font-awesome";
的application.js
//= require jquery
//= require turbolinks
//= require jquery_ujs
//= require jquery-ui/widgets/autocomplete
//= require autocomplete-rails
//= require select2-full
//= require bootstrap-sprockets
//= require moment
//= require moment/es
//= require bootstrap-datetimepicker
//= require toastr
//= require pickers
//= require_tree .
$("#dropdown").select2({
theme: "bootstrap"
});
meetings.js
$(document).ready(function() {
$('#ajax-example').select2({
ajax: {
url: "/meetings.json",
dataType: "json",
results: function(data, page) {
return {
results: $.map(data, function(meeting, i) {
return { id: meeting.id, text: meeting.name }
})
}
}
}
});
});
index.html.erb
**(指數電流)**
<input type="text" id="ajax-example" />
meetings_controller.rb
def index
@meetings = Meeting.order('name').all
end
的Gemfile
gem 'bootswatch-rails'
gem 'simple_form'
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.7'
gem 'jquery-rails'
gem 'will_paginate', github: 'jonatack/will_paginate'
gem 'ransack'
gem 'will_paginate-bootstrap'
gem "select2-rails"