jquery-select2

Laravel pluck but combining first name + last name for select

时光怂恿深爱的人放手 提交于 2019-12-13 15:18:18
问题 Using select2 with a Laravel / Vue project and need to return JSON in the following format: [ { id: 0, text: 'enhancement' }, { id: 1, text: 'bug' } ] In Laravel I know I can use pluck to create my list data e.g. for customers: $customers = Customer::pluck('id', 'first_name'); But Want to return the id and first name + last name as a single name. How can I do this? 回答1: Have you tried using Accessors? https://laravel.com/docs/5.4/eloquent-mutators#defining-an-accessor I have not tested it but

How to show the optgroup value + option value as the selection

醉酒当歌 提交于 2019-12-13 13:07:16
问题 Take a look at the following select: <select> <optgroup label="A"> <option value="">1</option> <option value="">2</option> <option value="">3</option> <optgroup label="B"> <option value="">4</option> <option value="">5</option> <option value="">6</option> </select> When any element is selected I would like to display its label + value in the selection instead of just value. So if 4 is selected I would like the selection to show B - 4 回答1: if you need the selected value back to its original

How to load model data to Select2 dropdown which uses Ajax filtering in Yii

和自甴很熟 提交于 2019-12-13 12:29:35
问题 I use the following select2 Yii widget in my view to populate a drop-down list. Since the data necessary for the preparation of the select list consists of more than 2K records I use select2 with minimumInputLength parameter and an ajax query to generate partial result of the list based on user input. If I create a new record I have no problem at all. It populates everything fine and I can save data to my database. However I don't know how to load saved data back to this drop-down during my

Use select2 plugin in AngularJS application

允我心安 提交于 2019-12-13 12:05:47
问题 I use select2 plugin in my AngularJS application for displaying list of some entities (tags). This is my template's part: select.ddlTags(ui-select2="select2Options", multiple, ng-model="link.tags") option(ng-repeat="tag in tags", value="{{tag.id}}") {{tag.name}} and this is my scope code's part: $scope.select2Options = { formatNoMatches: function(term) { var message = '<a ng-click="addTag()">Добавить тэг "' + term + '"</a>' console.log(message); return message; } } I want to provide ability

Select2 validate and force user to select ast least X items

大憨熊 提交于 2019-12-13 06:43:39
问题 I'm having some trouble trying to do some custom validation with a select2 jQuery plugin I need to force user to select at least 2 items from the list . The select2 plugin has a property maximumSelectionSize that allows user to select up to X items from the list, but it does not have the "inverse" property. Also the required tag won't work because I need user to select more than one item. As I'm working developing a custom validator with parsley validation plugin, I'd need to know how to get

Dynamic dependent dropdown with jquery-select2

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 04:43:48
问题 I am making 3 dynamic dependent dropdowns (selects) using this tutorial. I am also using jquery-select2 to enhance user experience. The first select is static (it has only three values), the other 2 are coming from mysql tables. The problem is: When I make selection on first select list. The second one becomes a simple (non-selectable) list of courses and the "Select List" is gone. The problematic page is live here. When I disable the jquery-select2 plugin, the select lists are working

Django select2 chained dropdown with elasticsearch

风格不统一 提交于 2019-12-13 04:26:46
问题 I would like to have a chained dropdown with elasticsearch as back end using Django. I have two indices in ES and I will use index A for the chained dropdown and index B for the search given contraints selected in index A using common fields. Like below where after selecting Lv0, Lv1 will be populated depending on the values selected in Lv0. After clicking submit form(I hope this can pass the selected variables to index B for query), query can be made over index B in selected Lv0 and Lv1 only

Select2, display tags into another DIV

淺唱寂寞╮ 提交于 2019-12-13 03:43:40
问题 I Would like display tags from a select2 form into another DIV. I tried the solution proposed by TJ Nicolaides https://stackoverflow.com/a/34140018/3030970 but it does not work on jQuery > 3 when you remove a tag, then add it again, you can not remove it any more $(".js-example-tags").select2({ tags: true }).on('change', function() { var $selected = $(this).find('option:selected'); var $container = $(this).siblings('.js-example-tags-container'); var $list = $('<ul>'); $selected.each(function

Angular UI Select2 in the Bootstrap Navigation Bar

左心房为你撑大大i 提交于 2019-12-13 02:43:46
问题 Select2 of the Angular-UI in Bootstrap navigation bar is giving error TypeError: Object [[object HTMLInputElement]] has no method 'is' Please refer to the http://plnkr.co/edit/yCG5M9 回答1: You need to load jQuery before AngularJS Just change the order to <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script> EDIT (blesh): This is because if angular doesn't see JQuery as it's

wenzhixin bootstrap-table unable to click on select2

扶醉桌前 提交于 2019-12-13 02:15:12
问题 Here is the problem, and a put together a mockup in Codeply http://www.codeply.com/go/rxWzeVwBUa. I am unable to click on the Select2 dropdown box withing the datatable. Any help would be appreciated. <div class="container"> <h1>From data</h1> <p></p> <table id="table"> <thead> <tr> <th data-field="id">ID</th> <th data-field="name">Item Name <select class='table finditem'> <option></option> <option value='0'>Item 0</option> ... </select> </th> <th data-field="price">Item Price</th> </tr> <