Skip to content

Commit

Permalink
Merge pull request #180 from flowforge/127-dropdown-output
Browse files Browse the repository at this point in the history
Only emit the "value" when dropdown selection is changed
  • Loading branch information
joepavitt authored Sep 7, 2023
2 parents 0efd302 + 30f584e commit 04c6ab7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ui/src/widgets/ui-dropdown/UIDropdown.vue
Original file line number Diff line number Diff line change
@@ -87,9 +87,20 @@ export default {
onChange () {
// ensure our data binding with vuex store is updated
const msg = this.messages[this.id] || {}
msg.payload = this.value
if (this.props.multiple) {
// return an array
msg.payload = this.value.map((option) => {
return option.value
})
} else if (this.value) {
// return a single value
msg.payload = this.value.value
} else {
// return null
msg.payload = null
}
this.$store.commit('data/bind', msg)
this.$socket.emit('widget-change', this.id, this.value)
this.$socket.emit('widget-change', this.id, msg.payload)
}
}
}

0 comments on commit 04c6ab7

Please sign in to comment.