Changeset c32f47b in tailbone
- Timestamp:
- 08/02/2020 07:13:40 PM (3 years ago)
- Branches:
- master
- Children:
- 808e737
- Parents:
- 4937855
- Location:
- tailbone
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tailbone/static/js/tailbone.buefy.autocomplete.js
r4937855 rc32f47b 23 23 selected: selected, 24 24 isFetching: false, 25 autocompleteValue: this.value,26 25 } 26 }, 27 28 watch: { 29 value(to, from) { 30 if (from && !to) { 31 this.clearSelection(false) 32 } 33 }, 27 34 }, 28 35 29 36 methods: { 30 37 31 clearSelection() { 38 clearSelection(focus) { 39 if (focus === undefined) { 40 focus = true 41 } 32 42 this.selected = null 33 this.autocompleteValue = null 34 this.$nextTick(function() { 35 this.$refs.autocomplete.focus() 36 }) 43 this.value = null 44 if (focus) { 45 this.$nextTick(function() { 46 this.$refs.autocomplete.focus() 47 }) 48 } 37 49 38 50 // TODO: should emit event for caller logic (can they cancel?) 39 51 // $('#' + oid + '-textbox').trigger('autocompletevaluecleared'); 52 }, 53 54 getDisplayText() { 55 if (this.selected) { 56 return this.selected.label 57 } 58 return "" 40 59 }, 41 60 … … 63 82 64 83 itemSelected(value) { 65 this.$emit('input', value) 84 if (this.selected || !value) { 85 this.$emit('input', value) 86 } 66 87 }, 67 88 -
tailbone/templates/autocomplete.mako
r4937855 rc32f47b 66 66 :name="name" 67 67 v-show="!selected" 68 v-model=" autocompleteValue"68 v-model="value" 69 69 :data="data" 70 70 @typing="getAsyncData"
Note: See TracChangeset
for help on using the changeset viewer.