From ff03dbcacaf4f756c872c17282c936e03b9bede6 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Thu, 28 Jun 2012 04:28:43 -0700 Subject: [PATCH] keep loading more results until there are enough to cause a scroll. closes #164 closes #164 closes #74 --- select2.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/select2.js b/select2.js index 38111166..5b68fbfa 100755 --- a/select2.js +++ b/select2.js @@ -81,7 +81,7 @@ } if (k.metaKey) return true; - + return false; }, isFunctionKey: function (k) { @@ -863,7 +863,6 @@ var results = this.results, more = results.find("li.select2-more-results"), below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible - offset = -1, // index of first element without data page = this.resultsPage + 1, self=this, term=this.search.val(), @@ -885,8 +884,8 @@ if (data.more===true) { more.detach(); - results.children().filter(":last").append(more); - more.removeClass("select2-active"); + results.children().filter(":last").append("
  • " + opts.formatLoadingNextSet(self.resultsPage) + "
  • "); + window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10); } else { more.remove(); }