Allow passing an index to selectRowAtIndex

This commit is contained in:
Alfredo Sumaran 2016-08-22 11:41:51 -05:00 committed by Bryce
parent 5963263912
commit 86f03e1750
1 changed files with 7 additions and 2 deletions

View File

@ -616,9 +616,14 @@
return this.dropdown.before($input);
};
GitLabDropdown.prototype.selectRowAtIndex = function() {
GitLabDropdown.prototype.selectRowAtIndex = function(index) {
var $el, selector;
selector = ".dropdown-content .is-focused";
// If we pass an option index
if (typeof index !== "undefined") {
selector = SELECTABLE_CLASSES + ":eq(" + index + ") a";
} else {
selector = ".dropdown-content .is-focused";
}
if (this.dropdown.find(".dropdown-toggle-page").length) {
selector = ".dropdown-page-one " + selector;
}