<igx-dialog #PasswordChangeDialog> <div class="card" style="width:450px;"> <div class="igx-grid-toolbar--compact"> <span class="igx-grid-toolbar__title">Change Password</span> <div class="igx-grid-toolbar__custom-content"> <button type="submit" accesskey="s" igxButton="outlined" displayDensity="compact" (click)="ChangPassword()" [disabled]="false"> <div class="igx-grid-toolbar__button-space"> <i class="far fa-save"></i> <span> Save</span> </div> </button> </div> </div>
</div>
</igx-dialog>
I want to prevent closing of dialog box when user clicks on escape button . This screen is mandatory and we don't want to close it without saving it. Now user can close this dialog on pressing escape button . Please anyone let us know how to do this.
Hi Sani, are you able to achieve this requirement?
Hello Sani,
After investigating further, I determined that currently we do not provide onClosing and onOpening events for the igxDialog. What I could suggest is creating a feature request in our GitHub repository here if you want to see it implemented in any of our future releases. This will give you the opportunity to communicate directly with our developers and get notifications when new information regarding your query is available.
When creating the request please be sure to be specific and provide as much details as possible. Attaching a working sample, screenshots and any information that consider relevant are going to be very helpful.
In the meantime I have prepared a sample, demonstrating how the onClosing event could be canceled. The event is accessed in a method bound to the onOpen event:
private stop = new Subject<boolean>();
open(e: IDialogEventArgs) {
e.dialog.toggleRef.onClosing
.pipe(takeUntil(this.stop))
.subscribe(e => {
e.cancel = true;
});
}
The subscription is composed with the takeUntil operator and uses a subject that emits truth when the “OK” button is clicked and the dialog is closed:
buttonClick() {
this.stop.next(true);
this.alert.close();
Please let me know if you need any further information regarding this matter.
Regards, Monika Kirkova, Infragistics