Dont lose existing values

This commit is contained in:
shamoon 2024-12-04 11:12:11 -08:00
parent a7f797e27f
commit a94266d0c6

View File

@ -52,7 +52,11 @@ export class CustomFieldsBulkEditDialogComponent {
) {}
initForm() {
this.form = new FormGroup({})
Object.keys(this.form.controls).forEach((key) => {
if (!this._fieldsToAddIds.includes(parseInt(key))) {
this.form.removeControl(key)
}
})
this._fieldsToAddIds.forEach((field_id) => {
this.form.addControl(field_id.toString(), new FormControl(null))
})