jquery - X-editable and Select2 with remote data not working -


i'm trying make x-editable , select2 work remote search.

here html blade templating. table id "table".

<td>     <a href="#" id="{{ $template->id }}" data-value="{{ $template->food_item_id }}" name="food_item" data-type="select2" data-pk="{{ $template->id }}" data-title="" class="editable-click food_item">         {{ $template->food_item_name }}    </a> </td> 

i'm using selector setup x-editable

    $('#table').editable({         selector: 'tbody tr td .food_item',         url: '/update',          select2: {             cachedatasource: true,             allowclear: true,             placeholder: 'select food item',             width: '200px',             id: function (item) {                 return item.id;             },             ajax: {                 url: '/json',                 datatype: "json",                 type: 'post',                 data: function(term, page) {                   return {                     q: term                   };                 },                 results: function(data, page) {                   return {                     results: data                   };                 }             }         }     }); 

the remote json in following format:

[{"id":"1","text":"jasmine tea"},{"id":"2","text":"green tea"},{"id":"3","text":"herbal tea"},{"id":"4","text":"tulsi tea"},{"id":"5","text":"chamomile tea"},{"id":"6","text":"mint tea"},{"id":"7","text":"ginger green tea"}] 

i

no results found

appreciate make work.

you must change json.

remember create object results

example:

{"results":[{"id":145,"text":" checker "},{"id":146,"text":" cherocke"}, {"id":147,"text":" chery "},{"id":148,"text":" chevrolet "}, {"id":410,"text":" jincheng"},{"id":502,"text":" marchetti "}, {"id":511,"text":" matchelss "},{"id":664,"text":" saic chery"}, {"id":680,"text":" scheuerle wabco "},{"id":853,"text":" winchemg"}]} 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -