select2-rails

Prevent select2 from flipping the dropdown upward

≡放荡痞女 提交于 2020-01-10 07:31:57
问题 As per title, is there a way to force select2 to always create a dropdown instead of a drop-up? There also appears to be some javascript that is either causing the flip when you scroll above the dropdown, adding a new CSS class "select2-drop-above", or both. EDIT: I should've specified that I'm pulling the library in via select2-rails. I'm hoping there is a way around this that doesn't involve pulling the whole select2 lib in myself and editing the select2.js file directly. 回答1: Modifying the

Prevent select2 from flipping the dropdown upward

为君一笑 提交于 2020-01-10 07:31:11
问题 As per title, is there a way to force select2 to always create a dropdown instead of a drop-up? There also appears to be some javascript that is either causing the flip when you scroll above the dropdown, adding a new CSS class "select2-drop-above", or both. EDIT: I should've specified that I'm pulling the library in via select2-rails. I'm hoping there is a way around this that doesn't involve pulling the whole select2 lib in myself and editing the select2.js file directly. 回答1: Modifying the

select2-rails + act_as_taggable_on rails 4 issue

痴心易碎 提交于 2019-12-31 07:08:10
问题 I installed select2-rails and act_as_taggable_on gem to my app. I setup the act_as_taggable_on and it works (I tested from the console). However, when I tried to create the view so that user can add new tag, it's not working. I want to make a tagging support like this: https://select2.github.io/examples.html#tokenizer. Here is my setup: apps/assets/application.js $(document).ready(function(){ $(".multiple-input").select2({ theme: "bootstrap"; tags: true; tokenSeparators: [','] }) }); apps

Select2-rails passing data to form field

左心房为你撑大大i 提交于 2019-12-24 08:41:35
问题 I'm trying to implement select 2 using the select2-rails gem but I'm not familiar with jQuery or rails. I basically tried to copy the placeholder example from this website and adapt it to my needs: http://rails-select2-example.herokuapp.com/ I have a field which lists performers for an event. Originally I just had a simple text field for :performer. But I'd like replace this with a lookup based on my users profile_name which I can then assign to the :performer field. So I have something like

Limit select2 selections by group?

江枫思渺然 提交于 2019-12-23 20:50:38
问题 Has anyone come up with a way to limit select2's selection by group? I'm hoping to auto-remove any selection from the same group once something from that group is selected (effectively limiting to one selection per group) I'll be working on something and will post it here if nobody posts a good solution before I'm finished. 回答1: It is possible to prevent selections from being made in Select2, so this can be done depending on how "group" is defined. If a "group" is an <optgroup> in a standard

Select2-rails is not working with ActiveAdmin

岁酱吖の 提交于 2019-12-13 18:09:55
问题 I have difficulties integrating select2-rails with ActiveAdmin. I followed setup steps on Select2-rails Github page: https://github.com/argerim/select2-rails and I added line: //= require select2 to app/assets/javascripts/application.js and line: *= require select2 to app/assets/stylesheets/application.css so I assume when I have page in ActiveAdmin I should be able to add line: $('#add_student_select').select2() to active_admin.js.coffee But its not working. In console I can see following

Select 2 in Rails not rendering properly

六月ゝ 毕业季﹏ 提交于 2019-12-12 03:55:17
问题 I am trying to implement select2 functionality in my project. It is not rendering properly. I am pasting my code, please tell me where it went wrong <div class="form-group"> <label for="userInputCollegeName">College Name</label> <%= f.collection_select(:college_id, College.all, :id, :name, {:prompt => 'Select the college'}) %> </div> <script>$(document).ready(function() { $("#user_college_id").select2({theme: "bootstrap"}); });</script> In my html the id for the collection_select is user

Select2, with rails and nested forms

放肆的年华 提交于 2019-12-11 17:38:14
问题 I having some troubles with select2. I am trying to implement a search function on a collection select. (lazily translated) View: <%= f.fields_for :baixa_itens do |baixa_item| %> <div> <%= baixa_item.label :item_id, "Item: " %> <%= baixa_item.collection_select(:item_id, @itens, :id, :to_s, {:prompt => "Select an item item" }, id: "select_search", style: 'width: 900px;') %><br> <%= baixa_item.label :ammount, "Ammount:" %> <%= baixa_item.number_field :ammount, :size => 4 %> </div> <% end %> <p>

How to initialize the selection for rails-select2 in BackboneForms schema?

风流意气都作罢 提交于 2019-12-04 06:46:19
问题 The project uses marionette-rails, backbone-on-rails, select2-rails and this port to BackboneForms to provide a multiselect form field. The select options are available to the user. They are retrieved from the collection containing the total list of options: MyApp.module("Products", function(Products, App, Backbone, Marionette, $, _) { Products.CustomFormView = Products.CustomView.extend({ initialize: function(options) { this.model.set("type", "Product"); Products.EntryView.prototype

Rails 5 ask_as_taggable with select2

我们两清 提交于 2019-12-02 19:35:36
问题 I cannot see the effect of select2 in rails 5 form whether it's a text_field or select. does anyone know why the tag_list is not being populated. I can see that the tag_list has values but as you see in the snap below, it shows "No results found". Does select2 work with Rails 5 as I've tried several options? form: Select all will display all values into the box <%= f.label :tags, "Tags (separated by commas)" %> <%= f.text_field :tag_list, value: f.object.tag_list.each { |e| e} %> <input type=