jquery-select2-4

How do I display the selected tags in Select2 below the dropdown box?

怎甘沉沦 提交于 2019-12-03 05:10:33
问题 I am using Select2 (version 4) with tags and would like to have the selected choices display below the input field. So instead of: Rather have: Is this possible and if so how do I achieve that? EDIT: Code is: <select class="js-example-tags form-control" multiple="multiple"> <option selected="selected">orange</option> <option selected="selected">white</option> <option selected="selected">purple</option> <option selected="selected">red</option> <option selected="selected">blue</option> <option

How do I display the selected tags in Select2 below the dropdown box?

北战南征 提交于 2019-12-02 18:27:25
I am using Select2 (version 4) with tags and would like to have the selected choices display below the input field. So instead of: Rather have: Is this possible and if so how do I achieve that? EDIT: Code is: <select class="js-example-tags form-control" multiple="multiple"> <option selected="selected">orange</option> <option selected="selected">white</option> <option selected="selected">purple</option> <option selected="selected">red</option> <option selected="selected">blue</option> <option selected="selected">green</option> </select> and $(".js-example-tags").select2({ tags: true }) When

Select2 JS Loading remote data with Ajax

删除回忆录丶 提交于 2019-12-02 12:18:27
问题 I am using Select2 JS Version 4.0.0-rc.1 and having trouble loading suggestions with remote Ajax method. Below are the markups and code <select class="form-control input-sm" id="selFrame1" name="selFrame1"> <option> Select Frame </option> </select> the JavaScript Jquery $('#selFrame1').select2({ ajax: { url: siteUrl+"suggest/frames", dataType: 'json', delay: 250, method:'POST', data: function (params) { return { q: params.term, // search term page: params.page }; }, processResults: function

select2 search - match only words that start with search term

╄→尐↘猪︶ㄣ 提交于 2019-12-01 03:05:02
I migrated from chosen to select2 plugin because it works better for me, but its documentation is very poor when compared to chosen. Could anyone tell me what option(s) should be used to make select2 search function to filter words that just begin with search term (and don't contain it in the middle). Let's say select2 field has those options: banana, apple, pineapple. When user enters "app" (or apple), only apple should be returned (because it's the only word that starts with apple). Now, it returns both apple and pineapple. After lots of search I figured out that some custom matcher needs to

Prevent reload of data with select2 plugin (v4)

懵懂的女人 提交于 2019-12-01 00:58:51
I'm using select2 plugin(v4) and loading his options with ajax. If i open the select input on the first time the data will be loaded. When I open the select again, the same data is reloaded. There is any way to prevent this "reloading" of data? I mean, if i just open the select2 and the options were previously loaded I don't want to load again. Here is my current code: $(select_input).select2({ ajax: { url: url, dataType: 'json', quietMillis: 250, data: function (params) { return { term: params.term, page: params.page, page_limit: default_page_size }; }, processResults: function (data) {

Prevent reload of data with select2 plugin (v4)

最后都变了- 提交于 2019-11-30 19:58:27
问题 I'm using select2 plugin(v4) and loading his options with ajax. If i open the select input on the first time the data will be loaded. When I open the select again, the same data is reloaded. There is any way to prevent this "reloading" of data? I mean, if i just open the select2 and the options were previously loaded I don't want to load again. Here is my current code: $(select_input).select2({ ajax: { url: url, dataType: 'json', quietMillis: 250, data: function (params) { return { term:

How to dynamically filter a select2 listing based on option class

孤街浪徒 提交于 2019-11-30 09:36:47
问题 I have a dropdown select of optional 'opportunities' ( id="opportunities" in the example below) which I enhance using the select2 jquery plugin, and wish to dynamically filter this list in order to reduce the possible options presented to a user using a 2nd select dropdown ( id="group-select" in the example below), <label> Select an opportunity<br> <select id="opportunities" style="width:300px;" multiple="multiple" name="selected-opps" value=""> <optgroup label="Class A"> <option class="group

How to change the css of color of select2 tags?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 08:44:16
I just started using project for showing multiple tags from a select box and it works great, thanks for the library. I just need to modify the color or css of the tags shown in multi-value select-boxes. Right now the color of the tag is shown as grey and I would like to change that to some other color according to the type of the tag. Or at least is there a way to change the default color? Also is it possible to change the css class of tags? There is an option such as formatResultCssClass but when I tried to add css classes through that property nothing changed, I would appreciate if someone

Select2 - Sorting results by query

孤者浪人 提交于 2019-11-30 08:36:14
I'm using Select2 version 4.0.0. If my results contain multiple words, and the user enters one of those words, I want to display the results sorted by where the entered word is within the result. For example, a user enters "apple", and my results are: "banana orange apple" "banana apple orange" "apple banana orange" Then "apple banana orange" should appear first in the list of select2 results, because that is the result in which "apple" appears earliest within the result. I don't care so much about the ordering past that. What do I override or configure to get something like this? It seems

Aurelia trying to load HTML from Select2?

青春壹個敷衍的年華 提交于 2019-11-29 15:07:27
So I'm trying to use Select2 within my Aurelia application. I installed Select2 using jspm install select2 , and within my app.html file I require Select2 using <require from="select2/js/select2.min.js"></require> . The browser loads the minified JS file fine, but for some reason it also tries to load http://localhost:3003/jspm_packages/github/select2/select2@4.0.0/js/select2.min .html . Why is Aurelia trying to load the HTML counterpart of the same JS file that I specified in my <require> element? How can I fix this? Thanks The purpose of <require from="...."></require> is to import a view