diff --git a/select2.css b/select2.css index 191ec067..3cc82545 100755 --- a/select2.css +++ b/select2.css @@ -464,3 +464,5 @@ disabled look for already selected choices in the results dropdown display: none; } /* end multiselect */ + +.select2-match { text-decoration: underline; } \ No newline at end of file diff --git a/select2.js b/select2.js index b5caa46c..4c7c6c10 100755 --- a/select2.js +++ b/select2.js @@ -223,6 +223,22 @@ return sizer.width(); } + function markMatch(text, term, markup) { + var match=text.toUpperCase().indexOf(term.toUpperCase()), + tl=term.length; + + if (match<0) { + markup.push(text); + return; + } + + markup.push(text.substring(0, match)); + markup.push(""); + markup.push(text.substring(match, match + tl)); + markup.push(""); + markup.push(text.substring(match + tl, text.length)); + } + /** * Produces an ajax-based query function * @@ -507,8 +523,8 @@ opts = $.extend({}, { containerCss: {}, dropdownCss: {}, - populateResults: function(container, results) { - var uidToData={}, populate, markup=[], uid, data, result, children; + populateResults: function(container, results, query) { + var uidToData={}, populate, markup=[], uid, data, result, children, formatted; populate=function(results, depth) { @@ -531,7 +547,13 @@ uidToData[uid]=result; } - markup.push(">