Untitled
unknown
plain_text
a year ago
1.4 kB
5
Indexable
$('#select2_ajax_simple_id').select2({ tags: true, maximumSelectionSize: 10, minimumResultsForSearch: Infinity, multiple: true, minimumInputLength: 1, placeholder: "Search Employee", //data:o, id: function(i) { return i; }, initSelection: function(element, callback) { }, ajax: { type: 'post', url: "https://stage-backend.foodbot.ai/getdata", allowClear: true, dataType: 'json', contentType: "application/json; charset=utf-8", delay: 250, data: function(term, page) { console.log(term); //Code for dummy ajax response return { query:"SELECT code,name FROM `mst_factura_claveprodserv` WHERE status=1" }; }, results: function(data, page) { return { results: data }; }, cache: false }, formatResult: function(i) { return '<div>' + i + '</div>'; }, // Formats results in drop down formatSelection: function(i) { return '<div>' + i + '</div>'; }, //Formats result that is selected dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller escapeMarkup: function(m) { return m; } // we do not want to escape markup since we are displaying html in results });
Editor is loading...