Fixes undefined value of taxonomy when moving from multiple to single valued metadata.
This commit is contained in:
parent
971042be33
commit
5569e59a0c
|
@ -155,9 +155,10 @@
|
|||
methods: {
|
||||
getTermsId() {
|
||||
let values = [];
|
||||
|
||||
if (this.value && this.itemMetadatum.metadatum && this.getComponent != 'tainacan-taxonomy-tag-input') {
|
||||
values = this.value.map(term => term.id).filter(term => term !== undefined);
|
||||
this.valueComponent = (values.length >= 0 && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.multiple === 'no') ? values[0] : values;
|
||||
this.valueComponent = (values.length > 0 && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.multiple === 'no') ? values[0] : values;
|
||||
} else if (this.value && this.itemMetadatum.metadatum && this.getComponent == 'tainacan-taxonomy-tag-input') {
|
||||
values = this.value.map((term) => { return { label: term.name, value: term.id } });
|
||||
this.valueComponent = values;
|
||||
|
|
Loading…
Reference in New Issue