jquery-select2

Select2 clone is working only twice

雨燕双飞 提交于 2019-12-10 12:05:48
问题 I'm trying to clone a select2 list and 2 text areas, but it's working only for the first clone, and I don't understand why..any new eye will certainly help ! (the cloning is OK, but the select2 is not applied to the 3rd clone) HTML part <fieldset> <div id="test"> <div> <label>Tool Name : </label> <select class="toollist" name="FSR_tool_id[]" style="width: 350px" /> <option></option> <option value="1" >bla 1</option> </select> <input type="Button" value="ADD ANOTHER TOOL" class="AddTool">

Select2 produces rough scrolling on mobile

て烟熏妆下的殇ゞ 提交于 2019-12-10 11:44:11
问题 I'm testing the Select2 jQuery component on an iPhone, and all I did was open their demo website: https://select2.org/getting-started/basic-usage If you test their State example on a phone, scrolling doesn't respond to pressure and doesn't fade smoothly. It's a rough line scroll. When you move your thumb, the lines don't fade in and out. On the other hand, on a desktop the scrolling/fading works great. It responds gracefully to mouse-wheel scrolls. Just wondering has anyone noticed this? EDIT

select2 on success retrieve newly created tag id

爷,独闯天下 提交于 2019-12-10 11:06:25
问题 In select2 I have tags loaded by AJAX, if the tag is not found in the db then the user has the option to create a new one. The issue is that the new tag is listed in the select2 box as a term and not as the id (what select to wants - especially becomes a problem when loading the tags again if the user wants to update since only the term and not the id is stored in the db). How can I, on success of adding the term, make it so that select2 recieves the ID and submits the ID instead of the tag

Select2 change container position

房东的猫 提交于 2019-12-10 09:19:22
问题 How can I adjust the position of Select2 container so that the search box is position right over the original select element like in this website http://www.jobnisit.com/en It look cleaner in terms of UI in my opinion. Ps. sorry, I can't post the image now. 回答1: There is 2 ways to do this. 1) With css: .select2-dropdown--below { top: -2.8rem; /*your input height*/ } This will not affect a container (.select2-container), but will move dropdown and search field, so you will have a desired

How to set select value in select2 plugin - jquery

陌路散爱 提交于 2019-12-10 06:35:24
问题 I use this code for insert data to select element with select2 plugin: $.ajax({ type: "POST", url: "ws.asmx/GetEvrakGrup", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (dc, status) { jsonData = JSON.parse(dc.d); $("#selectId").select2({ data: jsonData }); }, error: function () { alert("This is an Error");} }); After I want to set a value in this select but its not working: $("#selectId").val(81); 回答1: Try this : $("#selectId").val(81).trigger

Jquery Select2 plugin version check

▼魔方 西西 提交于 2019-12-10 03:45:36
问题 In my project I check if the Select2 plugin was loaded in this way if (jQuery().select2) But now I will try to verify what kind of version (3.5.X or 4.X) of Select2 plugin was loaded. I thought maybe you could check if there is an option/function introduced in version 4.X that is not present in the version 3.5.X. According to you, is it doable? How might I do it? Thank you 回答1: There is a new isOpen method in Select2 4.0. You can use something like this in your developer toolbar: try { $("#a

Select2 default options with ajax

僤鯓⒐⒋嵵緔 提交于 2019-12-10 03:01:11
问题 I have next html structure <select class="change_item_dropdown_ajax form-control" id="item_id" name="item_id" onchange="updateData(this, this.value, 16)" > <optgroup label="System Data"> <option value="17">Test</option> <option selected="selected" value="18">System</option> </optgroup> </select> Javascript $(".change_item_dropdown_ajax").select2({ ajax: { url: "get_user_items", dataType: 'json', delay: 250, theme: "classic", data: function (params) { return { q: { name_contains: params.term }

jquery select2 howto make dont close after select

时光毁灭记忆、已成空白 提交于 2019-12-10 01:42:42
问题 When using "Multi-Value Select Boxes" http://ivaynberg.github.io/select2/ slect box drop back after each selection. Is there the way not to do it, so user can select few of it without extra click to select box? Also interested in group options. In demo url above, "Pasific Time Zone", "Mountain Time Zone" not clickable. How to make it clickable and autoselect child items? 回答1: Question 1: From the documentation I can see this option: closeOnSelect: false This option is set to true by default,

Bootstrap4XPages plugin: how to catch a change event with Select2 Picker?

≯℡__Kan透↙ 提交于 2019-12-09 22:30:07
问题 I am using the BS4XSP plugin and the Select2 Picker/Combo for a Listbox. Unfortunately when using it I am not able to catch the change/click/keyup event of that Listbox to execute code. This is my code extract: <xp:div rendererType="bootstrap.Panel" title="Facets" id="facets"> <p> <xp:listBox id="searchFacets" multiple="true" value="#{sessionScope.searchFacets}"> <xp:selectItems> <xp:this.value> <![CDATA[#{javascript:search.getFacets()}]]> </xp:this.value> </xp:selectItems> </xp:listBox> <bx

Grouping results in Select2

∥☆過路亽.° 提交于 2019-12-09 14:16:41
问题 Is it possible somehow to group results in a Select2 component when it's not using <select> tag, but <input type="hidden"> , and results are provided as "data" option in configuration object? var select2Options = { data: { results: myArrayOfResults } }; 回答1: Yes, the results objects support a children attribute... so for example: var select2Options = { data: { results: [ {text: "My shiny group", children: [ {id: 1, text: "My shiny item"}, {id: 2, text: "My shiny item2"} ]} ] } }; 回答2: For