select2

Using Select2 (multiple selections) with vue.js

我的未来我决定 提交于 2020-01-02 10:03:46
问题 I'm new to vue and have followed their 'custom directive' at http://vuejs.org/examples/select2.html. This works well when only selecting one item, but when you're selecting multiple items it only passes the first one. I need it to pass all values selected. I have a jsfiddle set up displaying the code which is available here. https://jsfiddle.net/f3kd6f14/1/ The directive is as below; Vue.directive('select', { twoWay: true, priority: 1000, params: ['options'], bind: function() { var self =

Using Select2 (multiple selections) with vue.js

和自甴很熟 提交于 2020-01-02 10:03:32
问题 I'm new to vue and have followed their 'custom directive' at http://vuejs.org/examples/select2.html. This works well when only selecting one item, but when you're selecting multiple items it only passes the first one. I need it to pass all values selected. I have a jsfiddle set up displaying the code which is available here. https://jsfiddle.net/f3kd6f14/1/ The directive is as below; Vue.directive('select', { twoWay: true, priority: 1000, params: ['options'], bind: function() { var self =

How to change font color of select2 control using css

*爱你&永不变心* 提交于 2020-01-01 16:57:07
问题 I am using the following HTML code to include a select2 control in my form as below. <select id="element_id" class="select2" style="width:100%"> <option value="e1" >Element 1</option> <option value="e2" >Element 2</option> <option value="e3" >Element 3</option> </select> I am using the following style to format the font of the list items and selected item. <style> #s2id_element_id .select2-container--default .select2-selection--single .select2-selection__rendered { color: green ; } </style>

Select2 - Dropdown is not showing while API is working

℡╲_俬逩灬. 提交于 2019-12-25 08:49:23
问题 I am using the Select2 for my autocompletion and I am loading the list from remote. Have a look at the code below: HTML: <div> <select class="tagsSearch" style="width: 100%"> <option value="2" selected="selected"></option> </select> </div> jQuery: <script type="text/javascript"> $(".tagsSearch").select2({ placeholder: 'Search for tags', tags: true, multiple: true, tokenSeparators: [',', ' '], minimumInputLength: 2, minimumResultsForSearch: 1, ajax: { url: function (params) { return '/api

jQuery AJAX Request to HTTPS getting served to HTTP with Laravel and Select2

家住魔仙堡 提交于 2019-12-24 17:46:03
问题 I have a relatively simple Laravel app, that features an HTML form which contains a tag select element. The select element gets enhanced via select2 library. The tags are fetched via an XMLHttpRequest. I've created a fiddle, and the error I receive there is the same as on my production machine: [...]was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://blog.mazedlx.net/tags?term=asd'. This request has been blocked; the content must be served over HTTPS. $('#tags_id'

Select2: how to add a link instead of “No results found” text?

℡╲_俬逩灬. 提交于 2019-12-24 17:06:27
问题 Following is my code: $('#cow_id_2').select2({ allowClear: true, placeholder: "Search a cow/dam ID", formatNoMatches: function (term) { return "<a href=/'http://google.com/'>Add</a>"; } }); When I try to add a link the plugin just stop working. I am using Select2 4.0.3 version 回答1: If you're using version 4 or newer of select2, try this: $('#cow_id_2').select2({ allowClear: true, escapeMarkup: function (markup) { return markup; }, placeholder: "Search a cow/dam ID", language: { noResults:

Select2: how to add a link instead of “No results found” text?

感情迁移 提交于 2019-12-24 17:03:32
问题 Following is my code: $('#cow_id_2').select2({ allowClear: true, placeholder: "Search a cow/dam ID", formatNoMatches: function (term) { return "<a href=/'http://google.com/'>Add</a>"; } }); When I try to add a link the plugin just stop working. I am using Select2 4.0.3 version 回答1: If you're using version 4 or newer of select2, try this: $('#cow_id_2').select2({ allowClear: true, escapeMarkup: function (markup) { return markup; }, placeholder: "Search a cow/dam ID", language: { noResults:

Select2 - filtering special characters

橙三吉。 提交于 2019-12-24 04:23:22
问题 I have a problem with select2 plugin. When I use filter and type "mąka", it finds all the options with "mąka" and "maka" word. Is it possible to customize this script to find just the "mąka" word? Preview here Sorry for my english ;p Thanks! 回答1: From select2 site https://select2.github.io/examples.html#matcher fiddle : https://jsfiddle.net/alaniex/c3Ls1uf3/1/ function matchStart (term, text) { if (text.toUpperCase().indexOf(term.toUpperCase()) == 0) { return true; } return false; } $.fn

select2 not working when in google maps fullscreen

江枫思渺然 提交于 2019-12-24 02:03:08
问题 I have a google map that a user can go into fullscreen mode. I add a div with a dropdown as controls to the map and I apply the select2 plugin to the dropdown. The problem is the select2 dropdown doesn't show the list when the map is in fullscreen mode, when the map is not in fullscreen mode the dropdown works correctly. There are no errors in the console. I tried changing the z-index but had no luck. Any ideas? JSFiddle Example HTML <div id="wrapper"> <div id="testMap"> </div> <div id=

select2 not working when in google maps fullscreen

笑着哭i 提交于 2019-12-24 02:01:15
问题 I have a google map that a user can go into fullscreen mode. I add a div with a dropdown as controls to the map and I apply the select2 plugin to the dropdown. The problem is the select2 dropdown doesn't show the list when the map is in fullscreen mode, when the map is not in fullscreen mode the dropdown works correctly. There are no errors in the console. I tried changing the z-index but had no luck. Any ideas? JSFiddle Example HTML <div id="wrapper"> <div id="testMap"> </div> <div id=