Posts

Showing posts with the label jquery-select2

Dynamic select2 options using api

Dynamic select2 options using api I'll try to explain my problem as much as I can. I am trying to create, with select2 plugin, a way for the user to write some letters and on each letter pressed a call to an API that gives the first 20 results given by that API. select2 So I have my HTML select : <select name="filtre_products" class="form-control products-select2" multiple> </select> And then my JS (it's commented) : $(".products-select2").select2({ width: '100%', closeOnSelect: false, placeholder: '', minimumInputLength: 3, query: function (query) { var data = {results: }, i, j, s; if(query.term != null) { var ajax_r = ; $.ajax({ url: 'ajax_products_recherche.php?limite=10&real_json=1&recherche='+query.term, success: function(data_a){ //Getting the data data_a = JSON.parse...

Select2 Honor Selection Order?

Select2 Honor Selection Order? I am working on a replacement UI for a system I use and have come across something that has stopped me progressing. I have a select list where the user will select the codecs they with to use as well as have them in the order or preference. (Eg. G.729, G.711U, G711A) and this works in the default order. And using Select2 it is clean and simple for the user to understand. The issue I am facing is I need to be able to allow the user to chose the order. Eg G.711A, G.711U, G.729. Is this something that can be done using select2 or is there a better solution that would use a Multi-Select drop-down list or other method that would not require the user to manually type the codecs in their preferred order By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject ...