Hello,
I need to set the value of a kendo-combobox inside an angular form using code after receive the value from a webservice.
<form class="k-form" [formGroup]="usrForm">
<kendo-combobox #formContractor formControlName="formCity" [data]="cities"
textField="name" valueField="id" (valueChange)="ControlValueChange($event)" [clearButton]="true">
</kendo-combobox>
</form>
I have tried to set the value using object (my desire) or primitive value but the value is alwais null.
this.usrForm.controls['formCity'].setValue(newCityObj);
this.usrForm.controls['formCity'].patchValue(newCityObj);
this.usrForm.patchValue({formCity: newCityObj});
buth the control alwais remain blank,
if I show the form value in the console:
console.log(this.usrForm.value);
the formCity value is set but the value in the kendo-combobox are not displayed (kombo text remain blank)
I have see a lot of documentation and sample on read the value...but nothing about the set value by code.
Thanks
Maurizio
Hi Maurizio,
Thank you for the provided code.
The code does seem correct, and I am not sure why the component isn't being updated, as I have also tested updating the form using patchValue:
https://stackblitz.com/edit/angular-tbahrh?file=src%2Fapp%2Fapp.component.ts
In such a case, could you please share a runnable example that replicates the issue you're experiencing on your end? This will help me troubleshoot the configuration and provide more detailed assistance. Thank you in advance for your cooperation.
Regards,
Yanmario
Progress Telerik