Vue-multiselect: 'input' Event doesn't fire when change value programmatically

Created on 8 Jan 2020  路  3Comments  路  Source: shentao/vue-multiselect

Reproduction Link

https://jsfiddle.net/AlexanderHyriavets/caxfLs4u/5/

Steps to reproduce

  1. Click 'change value' button
  2. See console

Expected behavior

Emits 'input' when the value changes

Actual behavior

Does not emit 'input' event when the value changes

Description of the 'input' event in docs says: Emitted after this.value changes. But in this particular case it is not the truth.

Most helpful comment

@dwieringa & @alexhyriavets
Have you found a workaround for this by any chance?

Edit:
In case anyone is wondering if you set the ref attribute on the multiselect element
you can use the following after you set the value in programmaically to trigger the input event.

this.$refs.multiselectReference.$emit("input", your value)

All 3 comments

Maybe the resolution should be to change the documentation to state "Emitted after this.value is changed by user action." I am currently relying on the fact that this event only fires on user actions.

https://github.com/shentao/vue-multiselect/issues/1191 is related. When using :taggable="true", the addTag event handler you provide is responsible for updating the value.

See https://vue-multiselect.js.org/#sub-tagging

The event handler should add the received tag to both the options list and the value.

@dwieringa & @alexhyriavets
Have you found a workaround for this by any chance?

Edit:
In case anyone is wondering if you set the ref attribute on the multiselect element
you can use the following after you set the value in programmaically to trigger the input event.

this.$refs.multiselectReference.$emit("input", your value)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PrimozRome picture PrimozRome  路  3Comments

wujekbogdan picture wujekbogdan  路  4Comments

wujekbogdan picture wujekbogdan  路  4Comments

yaakovp picture yaakovp  路  3Comments

andreasvirkus picture andreasvirkus  路  3Comments