mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prevent selection of first item in typeahead list
This commit is contained in:
parent
c6b1503950
commit
19dc44df98
16
src/vendor/bootstrap/bootstrap.js
vendored
16
src/vendor/bootstrap/bootstrap.js
vendored
@ -1906,7 +1906,8 @@
|
|||||||
constructor: Typeahead
|
constructor: Typeahead
|
||||||
|
|
||||||
, select: function () {
|
, select: function () {
|
||||||
var val = this.$menu.find('.active').attr('data-value')
|
// CHANGE (rashidkpc) If nothing is selected, use existing value
|
||||||
|
var val = this.$menu.find('.active').attr('data-value') || this.$element.val();
|
||||||
this.$element
|
this.$element
|
||||||
.val(this.updater(val))
|
.val(this.updater(val))
|
||||||
.change()
|
.change()
|
||||||
@ -2005,7 +2006,8 @@
|
|||||||
return i[0]
|
return i[0]
|
||||||
})
|
})
|
||||||
|
|
||||||
items.first().addClass('active')
|
// CHANGE (rashidpc) Do not select first element by default
|
||||||
|
// items.first().addClass('active')
|
||||||
this.$menu.html(items)
|
this.$menu.html(items)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
@ -2116,8 +2118,14 @@
|
|||||||
this.lookup()
|
this.lookup()
|
||||||
}
|
}
|
||||||
|
|
||||||
e.stopPropagation()
|
if(e.keyCode === 13 && typeof this.$menu.find('.active').attr('data-value') === 'undefined') {
|
||||||
e.preventDefault()
|
// CHANGE (rashidkpc). Enter was hit, nothing was selected from typeahead, submit form
|
||||||
|
this.$element.submit();
|
||||||
|
} else {
|
||||||
|
e.stopPropagation()
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
, focus: function (e) {
|
, focus: function (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user