jquery-select2-4

jquery select2: error in getting data from php-mysql

北城以北 提交于 2019-11-27 06:28:56
问题 I am testing select2 plugin in my local machine. But for some reason. it is not collecting the data from database. I tried multiple times but not able to find the issue. Below are the code . <div class="form-group"> <div class="col-sm-6"> <input type="hidden" id="tags" style="width: 300px"/> </div> </div> <script type="text/javascript"> var lastResults = []; $("#tags").select2({ multiple: true, placeholder: "Please enter tags", tokenSeparators: [","], initSelection : function (element,

Select2 v4 how to paginate results using AJAX

放肆的年华 提交于 2019-11-26 20:35:40
问题 I'm trying to paginate results (every 25 rows) using Select2 4.0, but I don't know how to achieve it. Does somebody know how to do it? If the user reach the end of the 25 rows and if there is more rows I would like to load it and show it. Here is my HTML template <div class="form-group"> {!! Form::select('breed_id', $breeds, null, ['class' => 'form-control', 'id' =>'breed_id'] ) !!} </div> And here is the JavaScript for Select2. $("#breed_id").select2({ placeholder: 'Breed...', width: '350px'

Select2 4.0 - Push new entry after creation

那年仲夏 提交于 2019-11-26 17:48:22
问题 I have been using Select2 4.0.0-rc.1 for a couple of weeks (using the ajax adapter) and I am trying to find a way to "push" data after it has been initialized. Within the dropdown list, I have the choice to select an entry in the list (using ajax ) add a free entry (using createTag ) add a new entry If I select "add a new entry", I can fill out a form, and once saved, the new data must be shown as a selected entry. If I push data using select2_existing.select2( { data: data } ).val( 4 ); it

Select2 4.0.0 initial value with Ajax

孤者浪人 提交于 2019-11-26 14:55:30
I have a select2 v4.0.0 being populated from an Ajax array. If I set the val of the select2 I can see via javascript debugging that it has selected the correct item (#3 in my case), however this is not shown in the select box, it is still showing the placeholder. Whereas I should be seeing something like this: In my form fields: <input name="creditor_id" type="hidden" value="3"> <div class="form-group minimal form-gap-after"> <span class="col-xs-3 control-label minimal"> <label for="Creditor:">Creditor:</label> </span> <div class="col-xs-9"> <div class="input-group col-xs-8 pull-left select2