Skip to content

Commit 414c376

Browse files
committed
fixed a bug resetting scroll when loading more data.
1 parent fb69e3a commit 414c376

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

select2.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ the specific language governing permissions and limitations under the Apache Lic
13201320

13211321

13221322
self.opts.populateResults.call(this, results, data.results, {term: term, page: page, context:context});
1323-
self.postprocessResults(data);
1323+
self.postprocessResults(data, false, false);
13241324

13251325
if (data.more===true) {
13261326
more.detach().appendTo(results).text(self.opts.formatLoadMore(page+1));
@@ -1865,7 +1865,7 @@ the specific language governing permissions and limitations under the Apache Lic
18651865
},
18661866

18671867
// single
1868-
postprocessResults: function (data, initial) {
1868+
postprocessResults: function (data, initial, noHighlightUpdate) {
18691869
var selected = 0, self = this, showSearchInput = true;
18701870

18711871
// find the selected element in the result list
@@ -1878,8 +1878,9 @@ the specific language governing permissions and limitations under the Apache Lic
18781878
});
18791879

18801880
// and highlight it
1881-
1882-
this.highlight(selected);
1881+
if (noHighlightUpdate !== false) {
1882+
this.highlight(selected);
1883+
}
18831884

18841885
// hide the search box if this is the first we got the results and there are a few of them
18851886

0 commit comments

Comments
 (0)