Improve keydown handling for grid Add Filter autocomplete
should work the same, but this way also works with oruga
This commit is contained in:
parent
890ec64f3c
commit
098ed5b1cf
|
@ -581,26 +581,34 @@
|
|||
location.href = url
|
||||
},
|
||||
|
||||
addFilterButton(event) {
|
||||
addFilterInit() {
|
||||
this.addFilterShow = true
|
||||
|
||||
this.$nextTick(() => {
|
||||
const input = this.$refs.addFilterAutocomplete.$el.querySelector('input')
|
||||
input.addEventListener('keydown', this.addFilterKeydown)
|
||||
this.$refs.addFilterAutocomplete.focus()
|
||||
})
|
||||
},
|
||||
|
||||
addFilterHide() {
|
||||
const input = this.$refs.addFilterAutocomplete.$el.querySelector('input')
|
||||
input.removeEventListener('keydown', this.addFilterKeydown)
|
||||
this.addFilterTerm = ''
|
||||
this.addFilterShow = false
|
||||
},
|
||||
|
||||
addFilterKeydown(event) {
|
||||
|
||||
// ESC will clear searchbox
|
||||
if (event.which == 27) {
|
||||
this.addFilterTerm = ''
|
||||
this.addFilterShow = false
|
||||
this.addFilterHide()
|
||||
}
|
||||
},
|
||||
|
||||
addFilterSelect(filtr) {
|
||||
this.addFilter(filtr.key)
|
||||
this.addFilterTerm = ''
|
||||
this.addFilterShow = false
|
||||
this.addFilterHide()
|
||||
},
|
||||
|
||||
addFilter(filter_key) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<b-button v-if="!addFilterShow"
|
||||
icon-pack="fas"
|
||||
icon-left="plus"
|
||||
@click="addFilterButton">
|
||||
@click="addFilterInit()">
|
||||
Add Filter
|
||||
</b-button>
|
||||
|
||||
|
@ -38,8 +38,7 @@
|
|||
icon-pack="fas"
|
||||
clearable
|
||||
clear-on-select
|
||||
@select="addFilterSelect"
|
||||
@keydown.native="addFilterKeydown">
|
||||
@select="addFilterSelect">
|
||||
</b-autocomplete>
|
||||
|
||||
<b-button @click="resetView()"
|
||||
|
|
Loading…
Reference in a new issue