From 53eaf1fbe126cd13efb68f2793f88724500ed113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Aguirre?= Date: Wed, 21 Nov 2012 14:12:01 -0200 Subject: [PATCH] Results sorting option. Refs #95 --- select2.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/select2.js b/select2.js index ca355440..85c8e224 100644 --- a/select2.js +++ b/select2.js @@ -702,6 +702,9 @@ the specific language governing permissions and limitations under the Apache Lic populate=function(results, container, depth) { var i, l, result, selectable, compound, node, label, innerContainer, formatted; + + results = opts.sortResults(results, container, query); + for (i = 0, l = results.length; i < l; i = i + 1) { result=results[i]; @@ -2388,6 +2391,9 @@ the specific language governing permissions and limitations under the Apache Lic formatSelection: function (data, container) { return data ? data.text : undefined; }, + sortResults: function (results, container, query) { + return results; + }, formatResultCssClass: function(data) {return undefined;}, formatNoMatches: function () { return "No matches found"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " more character" + (n == 1? "" : "s"); },