jquery-select2

Select2 v4 clone don't pass the data

﹥>﹥吖頭↗ 提交于 2019-12-13 00:15:34
问题 I am attempting to do an AJAX call with the Select2 ver4 jquery plugin and Using Loading remote data of Select2 sample page. I am trying to clone a select which contains select2 tool. Before Question Clone select have already worked by good Adviser!!Thank you!! But clone element don't work use new AJAX(test.php). HTML CODE <tr> <td> <select class="js-example-data-ajax" id="sel1"> </select> </td> <td> <div class="hint">Get befor select value.</div> </td> <td> <button type="button" class=

Select2: Hide certain optgroup dynamically

别来无恙 提交于 2019-12-12 20:43:12
问题 I need to hide/show a certain option group (<optgroup>) conditionally and I've tried the top solution from this question - Select2: Hide certain options dynamically It hides every option (as required), but group title stays visible, although it has no child items. How to hide the whole option group in select2? 回答1: I think you can disable <optgroup> in Select2 only using data array source, not using options in HTML. See issues on Select2 github repo: https://github.com/select2/select2/issues

Select2 does not close the choices box on clicking outside it (with closeOnSelect=false)

三世轮回 提交于 2019-12-12 19:17:39
问题 JSFiddle: http://jsfiddle.net/xpvt214o/776660/ When the choice box is open, if you try clicking anywhere outside on the level of the choice box , it doesn't get closed. However, if you click outside on the level of the Current-Selection line, then it does get closed. How can I force the Select2 choice box to close when any outside click is performed, including on the level of the choice box? P.S. I am using the closeOnSelect: false option to keep the choice box always open during the

how to set values when Select2 is ready?

六眼飞鱼酱① 提交于 2019-12-12 17:48:49
问题 Does Select2 have any onLoad event so that I can set some default value? Now I resorted to some ugly trick after Select2 is added to the Dom with the help of Ember's didInsertElement : `setTimeout(function() {$select.select2('val', id).trigger('change'), 500}); I'm pretty sure there is a better solution out there :) 回答1: Try this, it may help you, $(document).ready(function() { $("<option value='0'>Default</option>").insertBefore("option:nth-child(1)"); }); 来源: https://stackoverflow.com

Select2 is duplicating my dropdown list

时光怂恿深爱的人放手 提交于 2019-12-12 12:32:36
问题 Select2 is duplicating my dropdown list so I have both the original select list and also the select2 select box, I have been unable to recreate it outside of my project so it could be an import perhaps, has anybody experienced anything similar before or know what imports could be causing it? The only information I could find was on jquery growfield which I do not have. Thanks! HTML <p class="form-control input-lg"><label for="industry">Industry</label>: <select class="industry" id="industry"

Select2 does not create name attribute

∥☆過路亽.° 提交于 2019-12-12 12:09:42
问题 With the select2 jQuery PlugIn I created a tag box. Therefore I used the following html form code: <form action="someAction" method="post"> <fieldset> <select id="tags" multiple="" name="tags"> <option value="tag1">val1</option> <option value="tag2">val2</option> <option value="tag3">val3</option> </select> <button type="submit" class="btn">Submit</button> </fieldset> </form> Select2 generates the following field from it: <input type="text" class="select2-input" autocomplete="off" id="s2id

close select2 dropdown via javascript/jquery

99封情书 提交于 2019-12-12 08:19:27
问题 Good day, How can I properly close a select2 dropdown via jquery or javascript?? for now Im using select2-dropdown.toggle() to close it, but I noticed that It will simply hide the list and the select2 box is still being highlighted I want to lost focus it or something like that just to close it properly and be able to come up with a result like this one . by the way the screen shots are dark because those select2 boxes are under a bootstrap modal that would come up whenever I press enter. Any

select2 rails form sends nothing

此生再无相见时 提交于 2019-12-12 05:49:06
问题 I'm stacked. I'm using select2 and acts_as_taggable to tag my order model. Here is a code <div class="field"> <%= f.label :tag_list, "TAGS" %><br> <%= f.select :tag_list, options_for_select([['Human', 'Hs'], ['Mouse', 'Mm'], ['Yeast', 'Sc']]),{},:multiple => true, :class =>"category" %> </div> And also script: <script> $(document).ready(function() {$(".category").select2(); }); </script> All works fine without connecting script ( with select2) but if with, it looks like working good but it

Handsontable Select2 Dependent Dropdowns

浪子不回头ぞ 提交于 2019-12-12 05:48:57
问题 I have two select2 dropdowns and I want to change options the second dropdown depending on first dropdown. For example, { data: 'country_id', editor: 'select2', renderer: customDropdownRenderer, select2Options: { data: {!! $production_units !!} , dropdownAutoWidth: true, } }, { data: 'state_id', editor: 'select2', renderer: customDropdownRenderer, select2Options: { data: [], dropdownAutoWidth: true, width: 'resolve' } }, Depending on country_id, I want to change select2 options of state_id. I

set multiple selected value on select2 multiple in asp.net dropdownlist from C#

被刻印的时光 ゝ 提交于 2019-12-12 05:42:39
问题 I need to add multiple author under a book. So i have used "Select2 Multiple" in asp dropdownlist. I was able to insert data but in edit mode i can't assign multiple selected value on dropdownlist. My dropdownlist in aspx page is <asp:DropDownList ID="ddlAuthor" runat="server" multiple="multiple" data-placeholder="Select Author (s)" CssClass="form-control select2"></asp:DropDownList> In C# i have tried as following but it add only one value. My c# code is foreach (DataRow row in dtAuthor.Rows