Skip to content

Commit aa2aaf8

Browse files
author
VladimirAmiorkov
committed
fix(picker): resolve issue with value coming from 'reactive forms' not updating the 'text'
1 parent 165de76 commit aa2aaf8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/picker.common.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,10 @@ export class PickerField extends TextField implements TemplatedItemsView {
159159
if (selectedIndex !== undefined) {
160160
let object = this.getDataItem(selectedIndex);
161161
this.selectedIndex = selectedIndex;
162-
let value = this.getValueFromField("valueField", this.valueField, object);
162+
let value = this.getValueFromField("selectedValue", this.valueField, object);
163163
this.selectedValue = value === undefined ? object : value;
164164

165-
let textValue = this.getValueFromField("textField", this.textField, object);
166-
textValue = textValue === undefined ? object : textValue;
167-
this.text = textValue;
165+
this.updatePickerText(object);
168166
}
169167

170168
this.disposeModalView();
@@ -415,9 +413,17 @@ export class PickerField extends TextField implements TemplatedItemsView {
415413
}
416414
}
417415

416+
private updatePickerText(object: any) {
417+
let textValue = this.getValueFromField("text", this.textField, object);
418+
textValue = textValue === undefined ? object : textValue;
419+
this.text = textValue;
420+
}
421+
418422
protected onModalAnimatedChanged(oldValue: boolean, newValue: boolean) { }
419423

420-
protected onSelectedValueChanged(oldValue: any, newValue: any) { }
424+
protected onSelectedValueChanged(oldValue: any, newValue: any) {
425+
this.text = newValue;
426+
}
421427

422428
protected onValueFieldChanged(oldValue: string, newValue: string) { }
423429

0 commit comments

Comments
 (0)