From 4f738a7fcc532ab2f2a16877771dc392acbb43b1 Mon Sep 17 00:00:00 2001 From: Liz Mitchell Date: Wed, 29 Aug 2018 09:09:36 -0500 Subject: [PATCH] fix(forms): incorrect value set with vaadin-combo-box when using itemValuePath --- forms/src/value-accessor.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/forms/src/value-accessor.ts b/forms/src/value-accessor.ts index c1c2f5e..8c7ef73 100644 --- a/forms/src/value-accessor.ts +++ b/forms/src/value-accessor.ts @@ -359,7 +359,7 @@ export class OrigamiControlValueAccessor extends DefaultValueAccessor !!element && element.multi === true && (this.isPropertyDefined(element, 'selectedValues') || - this.isPropertyDefined(element, 'selectedValues')) + this.isPropertyDefined(element, 'selectedItems')) ); } @@ -455,6 +455,13 @@ export class OrigamiControlValueAccessor extends DefaultValueAccessor } } - return this.useSelectableValueProp ? valueProp : indexProp; + if (element.itemValuePath) { + // will want to use selectedItem for object values. + // However, if `itemValuePath` is set then the control value is not the + // item itself, but the `value` property. + return 'value'; + } else { + return this.useSelectableValueProp ? valueProp : indexProp; + } } }