jquery-select2

Knockout/Select2: Triggering select2 to update based on an observable option updating

烈酒焚心 提交于 2020-01-24 17:58:26
问题 When upgrading from Knockout.js 2.x to 3.x, I've noticed this not working: I have a screen where I have a <select> depending on an observable array of observables, and I wrap the <select> with a Select2 wrapper. Now, it used to be that when one of the option observables was updated, the select would update. And that is still the case. But I can't get the Select2 binding to update properly at the same time. I'm using the binding handlers recommended by the Select2 Github page: ko

Select2 not using my templateResults or templateSelection options

▼魔方 西西 提交于 2020-01-23 04:28:06
问题 I am trying to use the select2 ajax call with templates. I am getting the ajax in just fine but it is not using my template functions. the ajax data is: [ {"name":"First thing","otherData":"asdfg"}, {"name":"Second thing","otherData":"qqerr"}, {"name":"third thing","otherData":"yerty"}, {"name":"fourth thing","otherData":"hgjfgh"}, {"name":"fifth thing","otherData":"fhgkk"} ] the select2 code (which i took a lot from here ) is: FundSearch = { create: function (selector, theURL) { $(selector)

select2 change ajax url

纵饮孤独 提交于 2020-01-14 14:03:33
问题 Im working with knockout.js and select2 plugin. Im trying to change the select2 ajax url based on a value of an observable. for example if based on some selection i do ajax call to 1 url or another. Here is a sample code: <input type="hidden" data-bind="combobox: { optionsText: 'Name', optionsValue: 'ID', optionsCaption: 'Избери...', sourceUrl: partnerUrl }, value: ApplyToSubject" id="ApplyToSubject" name="ApplyToSubject"> This is how the sourceUrl: partnerUrl is retrieved: self.partnerUrl =

How to clone select2 v4 Ajax

£可爱£侵袭症+ 提交于 2020-01-14 03:11:28
问题 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. But select2 dropdown disabled when cloning. HTML CODE <tr> <td> <select class="js-example-data-ajax" id="sel1"> </select> <button type="button" class="addline">Add Line</button> </td> </tr> jQuery CODE $.fn.select2.amd.require( ["select2/core", "select2/utils", "select2/compat/matcher"], function (Select2, Utils,

Select2 basic example not working

早过忘川 提交于 2020-01-13 16:51:09
问题 I am trying to get select2 library working with symfony2 script. I am trying to implement basic example provided https://select2.github.io/examples.html page. Thus I added to my page header: <!-- SELECT 2--> <link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" /> <script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script> <!-- /SELECT2 --> and following this code provided in example: <script type="text/javascript"> $

Set language not working select2

微笑、不失礼 提交于 2020-01-13 07:42:51
问题 <select data-placeholder="Select or type" data-minlength="2" multiple = "multiple" name='arrAval' id='listAval' class="js-basic-multiple form-control" required> So here is the issue: As the documentation says I should be able to set language for this component: $(".js-basic-multiple").select2({ language: "language-wanted" }); It's returning "no results found" no matter which language I set. Just to be clear, as in https://select2.github.io/examples.html#matcher it returns "No se encontraron

Yii: The system is unable to find the requested action “select”

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-11 13:23:08
问题 what i am doing is trying using the yii select2 extension to create a searchable dropdown list. i have downloaded the extension from this link and following it "http://www.yiiframework.com/extension/select2/". i have put the unzipped file(which is select2) in protected/extensions and i have then created a php file in "protected/views/site/select.php" in which i pasted the code below and when i try to run it via "webapp/index.php/site/login" it gives this error " Error 404 The system is unable

Select2 4.0.0 Bootstrap theme

≡放荡痞女 提交于 2020-01-11 08:37:06
问题 In select2 4.0 version there is a theme option. However in the documentation I can't find what does the option mean and how can I create custom theme (https://select2.github.io/examples.html) I've found bootstrap 3 theme for select2, but it seems to be working only for 3.5 version. So I could I create custom theme for select2 latest version (4.0)? Basically I need bootstrap 3 styling preferably with LESS file 回答1: @fk is working on a Bootstrap 3 theme for Select2 4.0.0. https://github.com

Change default font of Select2

▼魔方 西西 提交于 2020-01-11 06:54:11
问题 I am using the Select2 plugin to add the search feature to my dropdowns. However, I want the font style of these drop downs to be set to the same font as my other fields: font-family: Arial, Helvetica, sans-serif; My 'Select' HTML: <label>Department</label> <select class='js-example-basic-single' name="department" id="department" required> <option value="Dep 1">Dep 1 </option> <option value="Dep 2">Dep 2 </option> etc..... </select> My JavaScript: $(document).ready(function() { $(".js-example

Select2 - Sorting results by query

拥有回忆 提交于 2020-01-10 13:11:28
问题 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