1

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

derstauner
  • 1,478
  • 2
  • 23
  • 44

1 Answers1

0

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

justintimeza
  • 1,064
  • 4
  • 8
  • Yes, in the closeButtonClick it is redundant, because it emits the closeButtonClicked event, which calls the closePopup event, which hides the popup and because of the property change, it calls the popupHiding. But it is needed. In your example, if I type some value in the document number field, it will be there after closing the popup via the close button or the x button. And I have to set the default values to null in the popupHiding event too. Now, it works as expected. I have modified your example. – derstauner Jul 12 '20 at 08:44