2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-09 23:01:00 +00:00

Merge pull request #251 from freax/auto-select-first-fix

Fix for scroll on autoselect first item
This commit is contained in:
Tomas Kirda 2014-10-06 15:49:26 -05:00
commit 75879a89c1

View File

@ -669,21 +669,21 @@
noSuggestionsContainer.detach(); noSuggestionsContainer.detach();
container.html(html); container.html(html);
// Select first value by default:
if (options.autoSelectFirst) {
that.selectedIndex = 0;
container.children().first().addClass(classSelected);
}
if ($.isFunction(beforeRender)) { if ($.isFunction(beforeRender)) {
beforeRender.call(that.element, container); beforeRender.call(that.element, container);
} }
that.fixPosition(); that.fixPosition();
container.show(); container.show();
that.visible = true;
// Select first value by default:
if (options.autoSelectFirst) {
that.selectedIndex = 0;
container.scrollTop(0);
container.children().first().addClass(classSelected);
}
that.visible = true;
that.findBestHint(); that.findBestHint();
}, },