Welcome to the Angular feedback portal. We’re happy you’re here! If you have feedback on how to improve the Angular, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
If you use an #editTemplate for a column, and put a select inside of it, after clicking Update, the args.data for this column always contains the value of the last option for the select, regardless of which option the user actually selects. This happens when using Normal edit mod.
Here's an example template that I'm using:
Snippet <e-column field="agencyId" [isPrimaryKey]="true">
<ng-template #editTemplate let-data>
<select name="agencyId" attr.aria-label="Agency" class="form-control"> <option value="" selected>Select Agency</option>
<option *ngFor="let agency of availableAgencies" [value]="agency.agencyId">{{agency.name}}</option>
</select>
</ng-template>
<ng-template #template let-data>
<div>{{data.name}}</div>
</ng-template>
</e-column>
I believe the problem is coming from this code:
let inputElements: HTMLInputElement[] = [].slice.call(form[getComplexFieldID(col.field)]); inputElements = inputElements.length ? inputElements : [form[getComplexFieldID(col.field)]]; inputElements.forEach((input: HTMLInputElement) => { let value: number | string | Date | boolean = this.getValue(col, input, editedData); DataUtil.setValue(col.field, value, editedData);
});
Calling Array.slice() on a select element returns an array of its options, so they get looped over, and the value from the final one ultimately gets set as the field value.