jquery-select2

select2 - hiding the search box

白昼怎懂夜的黑 提交于 2019-12-03 00:10:54
问题 For my more significant selects, the search box in Select2 is wonderful. However, in one instance, I have a simple select of 4 hard-coded choices. In this case, the search box is superfluous and looks a little silly being present. Is it possible to hide it somehow? I took a look through the documentation online and couldn't find any options for this in the constructor. I could, of course, just use a regular html select, but for consistency I'd like to use Select2 if possible. 回答1: See this

Rails 5 ask_as_taggable with select2

我们两清 提交于 2019-12-02 19:35:36
问题 I cannot see the effect of select2 in rails 5 form whether it's a text_field or select. does anyone know why the tag_list is not being populated. I can see that the tag_list has values but as you see in the snap below, it shows "No results found". Does select2 work with Rails 5 as I've tried several options? form: Select all will display all values into the box <%= f.label :tags, "Tags (separated by commas)" %> <%= f.text_field :tag_list, value: f.object.tag_list.each { |e| e} %> <input type=

Select2 not getting data via AJAX

为君一笑 提交于 2019-12-02 18:28:01
I have the following code which should be getting data via AJAX using Select2 $('#Organisation').select2({ ajax: { url: AppURL + 'Organisations/Manage/SearchByName/', dataType: 'json', quietMillis: 100, data: function (term) { return { term: term }; }, results: function (data) { return { results: data }; } } }); If I look at the request using Web Inspector when searching 'O' I get: [{"label":"Organisation 1","ID":2},{"label":"Organisation 2","ID":1}] Any ideas what I'm doing wrong? I'd presume something incorrect in the results function. The error I get is: Uncaught TypeError: Cannot call

i want to use multiple select2 onchange function in a dynamic way

巧了我就是萌 提交于 2019-12-02 16:35:08
问题 I want to put select2 function in my code but don't know where to put that .select2() function i have this .append($(<?php echo json_encode($property_address1); ?>)) my model ` function property_address1() { $query = $this->db->query('SELECT host,price,city,property_thumbnail, apartments_type, contactnumber, contactperson,photographlinks,emailid, propertyaddress FROM tbl_contacts')->result(); $output = '<select id="neww" class="property_add_ form-control">'; foreach ($query as $row) { //echo

select2 - hiding the search box

末鹿安然 提交于 2019-12-02 15:40:39
For my more significant selects, the search box in Select2 is wonderful. However, in one instance, I have a simple select of 4 hard-coded choices. In this case, the search box is superfluous and looks a little silly being present. Is it possible to hide it somehow? I took a look through the documentation online and couldn't find any options for this in the constructor. I could, of course, just use a regular html select, but for consistency I'd like to use Select2 if possible. See this thread https://github.com/ivaynberg/select2/issues/489 , you can hide the search box by setting

NodeJS with webpack jQuery.Deferred exception: o(…).select2 is not a function TypeError: o(…).select2 is not a function

一世执手 提交于 2019-12-02 14:34:21
问题 I'm modifying my application to use nodejs and browserify via gulp to produce one minified js. I've switched from loading dependencies manually and updating manually to installing them with npm. Everything went smooth, but when I wanted to install select2 it started throwing errors all over the place. When I moved my removed manual updated file for the npm required() file. jquery.js:3841 jQuery.Deferred exception: o(...).select2 is not a function TypeError: o(...).select2 is not a function at

Select2 JS Loading remote data with Ajax

删除回忆录丶 提交于 2019-12-02 12:18:27
问题 I am using Select2 JS Version 4.0.0-rc.1 and having trouble loading suggestions with remote Ajax method. Below are the markups and code <select class="form-control input-sm" id="selFrame1" name="selFrame1"> <option> Select Frame </option> </select> the JavaScript Jquery $('#selFrame1').select2({ ajax: { url: siteUrl+"suggest/frames", dataType: 'json', delay: 250, method:'POST', data: function (params) { return { q: params.term, // search term page: params.page }; }, processResults: function

NodeJS with webpack jQuery.Deferred exception: o(…).select2 is not a function TypeError: o(…).select2 is not a function

和自甴很熟 提交于 2019-12-02 09:29:40
I'm modifying my application to use nodejs and browserify via gulp to produce one minified js. I've switched from loading dependencies manually and updating manually to installing them with npm. Everything went smooth, but when I wanted to install select2 it started throwing errors all over the place. When I moved my removed manual updated file for the npm required() file. jquery.js:3841 jQuery.Deferred exception: o(...).select2 is not a function TypeError: o(...).select2 is not a function at i.init ( https://www.example.com/newstyle/js/closure.js?time=1559747711:1:5612 ) at i.sysInit ( https:

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

删除回忆录丶 提交于 2019-12-02 09:22:16
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 to find the requested action "select"." Please help me with this, thankyou..!! //code in select.php

django/ajax CSRF token missing

南笙酒味 提交于 2019-12-02 08:35:57
I have the following ajax function which is giving me a cross site forgery request token error once I get past the minimumlengthinput of 3 with the select2 control. Knowing this I attempted to add { csrfmiddlewaretoken: '{{ csrf_token }}' }, to my data:. After adding the csrfmiddlewaretoken I'm still getting the CSRF token missing or incorrect error. I believe it has something to do with the my function for the searchFilter and searchPage follows. What is the proper way to do this? // using jQuery function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie !== '')