Closed vinitkumar33 closed 3 years ago
@vinitkumar33 So, a few problems with the source you've provided:
dropdownValues
instead of dropdownValues1
, when dropdownValues1 is the array with objects containing multiple propertiesdropdownValues1
, you should be building new FormControls like so: new FormControl({name1: 'Mango', disabled: false }, Validators.required)
emphasis on using name1
instead of value
patchValue
you cannot simply pass a string, you must pass an object like so .patchValue({name1: 'Orange'})
and you should see the desired effectClosing this issue, because with the changes I suggested above, everything works fine but feel free to reopen for further discussion if necessary
Is this a bug, enhancement, or feature request?
Bug
Briefly describe your proposal.
Can not pre populate value of combo box when its values are model with multiple attribute and has a displayFn.
Which versions of Angular and Fundamental Library for Angular are affected? (If this is a feature request, use current version.)
Fundamental-ngx 0.18.0
When a combo-box is used with display function where the dropdownValues is an object with multiple attribute. When we try to pre populate the combobox with default value, it doesnt work. It works perfectly fine for combobox without displayFn.
In the below example, I have tried to achieve populating combobox value on click of a button. I have two combo-box - One (disabledComboControl) properly populates values but the other one doesnt (disabledComboControl1). I have tried populating the value in multiple ways.. //this.customForm.controls.disabledComboControl1.patchValue('Newval'); or //this.customForm.controls.disabledComboControl1.patchValue({name1: 'AppleNew'}); Or //this.customForm.setValue({disabledComboControl: '1', disabledComboControl1: '2', disabledComboControl2: '3'});
None of the above works
HTML