From f1a5fe2c9e4e5bd2bb4cf3d54cd28876ae17fcff Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Wed, 22 May 2013 23:38:39 -0700 Subject: [PATCH] remove dupe format no matches messages. fixes #1341 --- select2.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 3f2b8b04..c3de0af1 100644 --- a/select2.js +++ b/select2.js @@ -1571,7 +1571,9 @@ the specific language governing permissions and limitations under the Apache Lic } if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) { - render("
  • " + opts.formatNoMatches(search.val()) + "
  • "); + if (results.find(".select2-no-results").length === 0) { + render("
  • " + opts.formatNoMatches(search.val()) + "
  • "); + } return; } @@ -2755,7 +2757,7 @@ the specific language governing permissions and limitations under the Apache Lic //If all results are chosen render formatNoMAtches if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){ - if(!data || data && !data.more) { + if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) { this.results.append("
  • " + self.opts.formatNoMatches(self.search.val()) + "
  • "); } }