Search code examples
angulardevextreme-angular

unable to set textbox value after resetting form values


I have a form with several fields. The form is showing up in a popup, after clicking a button on a toolbar. In this button click event I set some default value for a new item. After the popup shows and the user clicks on cancel or close the popup, I reset the form field values. If I then want to add a new item once again, the popup shows, but the default value is not set for the internalNumber field, but interestingly only for the date. I can't figure out, why? I set the value for this two editors the same way in the markup and in the controller.

Here is a testing sample: https://stackblitz.com/edit/angular-dxpopup-wznhbc


Solution

  • The "resetFormValues" function is causing the issues. You're also calling it twice, in the closePopup function and the closeButtonClick function.

    Here is an updated sample: https://stackblitz.com/edit/angular-dxpopup-vsjtvu