From dd34cc5d67afa9a0999c3ec1768399ed69715228 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Thu, 14 Mar 2013 10:00:25 -0700 Subject: [PATCH] always show spinner during searching. fixes #950 fixes #943 --- select2.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/select2.js b/select2.js index d8d78f23..0cbc5abf 100644 --- a/select2.js +++ b/select2.js @@ -1356,8 +1356,6 @@ the specific language governing permissions and limitations under the Apache Lic return; } - search.addClass("select2-active"); - function postRender() { results.scrollTop(0); search.removeClass("select2-active"); @@ -1386,9 +1384,6 @@ the specific language governing permissions and limitations under the Apache Lic } return; } - else if (opts.formatSearching() && initial===true) { - render("
  • " + opts.formatSearching() + "
  • "); - } if (opts.maximumInputLength && search.val().length > opts.maximumInputLength) { if (checkFormatter(opts.formatInputTooLong, "formatInputTooLong")) { @@ -1399,6 +1394,12 @@ the specific language governing permissions and limitations under the Apache Lic return; } + if (opts.formatSearching && this.findHighlightableChoices().length === 0) { + render("
  • " + opts.formatSearching() + "
  • "); + } + + search.addClass("select2-active"); + // give the tokenizer a chance to pre-process the input input = this.tokenize(); if (input != undefined && input != null) {