jquery-select2

Select2 on change event is not working in Vuejs

限于喜欢 提交于 2019-12-17 20:24:47
问题 I was working with select2 in vuejs , I found vuejs is not working with jquery select2 as vuejs is working with navite html. I am using this code Vue.directive('select', { twoWay: true, bind: function () { $(this.el).select2() .on("select2:select", function(e) { this.set($(this.el).val()); }.bind(this)); }, update: function(nv, ov) { $(this.el).trigger("change"); } }); var app = new Vue({ el: '#app', data: { supplier_id: "niklesh" } }) $('#supplier_id').select2({}); <script src="https://cdnjs

How do I fire a new ajax on select2 new /remove tag event?

五迷三道 提交于 2019-12-17 20:20:07
问题 I use the following snippet to add a new select2 tag remotely with ajax and I want to register or remove some records of my many to many table on new tag / remove tag event The Table looks like --------------------------------- +--voucher_id--+|+--product_id--+ --------------------------------- + 123 | 566 + --------------------------------- + 156 | 566 + --------------------------------- + 123 | 426 + --------------------------------- + 156 | 516 + --------------------------------- My

Can't set multiple values in Select2

痴心易碎 提交于 2019-12-17 18:56:40
问题 I am trying to show selected values in select2-jquery component. var select = $(".select2").select2({ multiple: true, placeholder: "", width:'100%', data: z }); var selectedValues = $("#sourceValues").val().split(','); $.each( selectedValues, function(k,v){ $(".select2").select2('val',v); }) Element sourceValues holds the value e.g : 2,4 And z is array of object that holds id and text as suggested. I can see the <options> that is linked to the Select2 element but I am unable to show the

How to load JSON data to use it with select2 plugin

℡╲_俬逩灬. 提交于 2019-12-17 18:52:01
问题 I want to use select2 plugin for my project. I followed this example, but it doesn't work for me. JSON output : [ {"ime":"BioPlex TM"}, {"ime":"Aegis sym agrilla"}, {"ime":"Aegis sym irriga"}, {"ime":"Aegis sym microgranulo"}, {"ime":"Aegis sym pastiglia"}, {"ime":"Agroblen 15816+3MgO"}, {"ime":"Agroblen 18816+3MgO"}, {"ime":"Agrobor 15 HU"}, {"ime":"Agrocal (Ca + Mg)"}, {"ime":"Agrocal (Ca)"}, {"ime":"Agrogold"}, {"ime":"Agroleaf Power 12525+ME"}, {"ime":"Agroleaf Power 151031+ME"}, {"ime":

Select2 doesn't show selected value

若如初见. 提交于 2019-12-17 18:07:04
问题 Select2 loads all items from my list successful, the issue I found when try to select a specific value when page loads. Example: :: put select2 in a specific html element, no value is selected even all items are loaded. $('#my_id').select2(); :: When the page is loaded I'm trying to show a specific item selected, but doesn't work as expected, because even selected, the select2 doesn't show it. $('#my_id').val('3'); //select the right option, but doesn't render it on page loads. How to make a

Tagging with AJAX in select2

人走茶凉 提交于 2019-12-17 17:24:04
问题 I am doing tagging with select2 I have these requirements with select2: I need to search some tags using select2 ajax Also I need to use "tags" in select2 which Allows values that are not in the list(Ajax result). Both the scenarios work independently. But joined together aJax values are only populated. If we type any other values not in the list then it says "no matches found" My scenario If user type any new value which is not in the list, allow them to make up their own tag. Any way to

Tagging with AJAX in select2

夙愿已清 提交于 2019-12-17 17:22:28
问题 I am doing tagging with select2 I have these requirements with select2: I need to search some tags using select2 ajax Also I need to use "tags" in select2 which Allows values that are not in the list(Ajax result). Both the scenarios work independently. But joined together aJax values are only populated. If we type any other values not in the list then it says "no matches found" My scenario If user type any new value which is not in the list, allow them to make up their own tag. Any way to

Unable to select a result from the select2 search results

杀马特。学长 韩版系。学妹 提交于 2019-12-17 16:46:36
问题 I am using the select2 for on of my search boxes. I'm getting the results from my URL but I'm not able to select an option from it. I want to use the 'product.productName' as the text to be shown after selection. Is there anything that I have missed out or any mistake that I have made. I have included select2.css and select2.min.js,jquery.js function dataFormatResult(product) { var markup = "<table class='product-result'><tr>"; markup += "<td class='product-info'><div class='product-title'>"

select2 and jquery validation not working properly

笑着哭i 提交于 2019-12-17 14:58:49
问题 Trying to use validation on select2 with a few issues : the error message will show, but it will not remove when a valid entry is entered. I am loading an initial value which works fine... the validator, however, does not recognize the value and tells me it is invalid... I have to manually type in the same value and then it validates, but still does not remove the error class/message showing it is valid. form : <div class="col-md-12 margin-bottom-30 form-group"> <div class="input-modal-group"

Cloned Select2 is not responding

妖精的绣舞 提交于 2019-12-17 09:19:15
问题 I am trying to clone a row which contains select2 tool ,when i clone that row using jQuery the cloned select2 is not responding.In image given below first select2 which is original is working fine but 2nd and 3rd select2 which are cloned not responding code snippet: $(document).ready(function() { var clonedRow = $('.parentRow').clone().html(); var appendRow = '<tr class = "parentRow">' + clonedRow + '</tr>'; $('#addRow').click(function() { $('#test').after(appendRow); }); }); <script src=