diff --git a/src/classes/field-types/category/AddNewTerm.vue b/src/classes/field-types/category/AddNewTerm.vue index 20daa78b7..7539ae8fd 100644 --- a/src/classes/field-types/category/AddNewTerm.vue +++ b/src/classes/field-types/category/AddNewTerm.vue @@ -89,14 +89,16 @@ .then( res => { instance.name = ''; instance.parent = 0; + if( res.data && res.data.term_id || res.term_id ){ let term_id = ( res.term_id ) ? res.term_id : res.data.term_id; let val = this.value; + if( !Array.isArray( val ) && this.field.field.multiple === 'no' ){ axios.patch(`/item/${this.item_id}/metadata/${this.field_id}`, { values: term_id, }).then( res => { - instance.$emit('newTerm', true); + instance.$emit('newTerm', term_id); }) } else { val = ( val ) ? val : []; @@ -104,10 +106,9 @@ axios.patch(`/item/${this.item_id}/metadata/${this.field_id}`, { values: val, }).then( res => { - instance.$emit('newTerm', true); + instance.$emit('newTerm', val); }) } - } }); } diff --git a/src/classes/field-types/category/Category.vue b/src/classes/field-types/category/Category.vue index 20df30da4..1da5d2d58 100644 --- a/src/classes/field-types/category/Category.vue +++ b/src/classes/field-types/category/Category.vue @@ -125,7 +125,9 @@ this.$emit('input', this.inputValue); this.$emit('blur'); }, - reload(){ + reload( val ){ + this.valueComponent = val; + this.terms = []; this.getTermsFromTaxonomy(); this.getTermsId(); diff --git a/src/classes/field-types/category/CategoryCheckbox.vue b/src/classes/field-types/category/CategoryCheckbox.vue index 5cd61a38e..fda2e17ab 100644 --- a/src/classes/field-types/category/CategoryCheckbox.vue +++ b/src/classes/field-types/category/CategoryCheckbox.vue @@ -28,6 +28,11 @@ checked: [] } }, + watch: { + value( val ){ + this.checked = val; + } + }, props: { options: { type: Array diff --git a/src/classes/field-types/category/CategoryRadio.vue b/src/classes/field-types/category/CategoryRadio.vue index bb6b09afb..676cd8d30 100644 --- a/src/classes/field-types/category/CategoryRadio.vue +++ b/src/classes/field-types/category/CategoryRadio.vue @@ -19,13 +19,14 @@