Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
Make OnClose event run when clicking outside dialog box with dismissableMask set true

I have a dialog box that accepts user input and runs a function on closing of the dialog box. Using primeng dynamic dialog component. This function is called during the onClose event. This works fine with a close button.

I have dispossable mask on to allow user to close box by clicking outside of it. Here the onClose event doesnt fire. Is there any way to capture the event where user clicks outside the box or to make onClose fire?

https://www.primefaces.org/primeng/dynamicdialog

component 1

addQuoteDialog() {
    let selectedData = this.gridApi.getSelectedRows();

    const ref = (this.addQuoteDialogRef = this.dialogService.open(
      AddQuoteDialogComponent,
      {
        width: '95%',
        styleClass: 'user-details',
        showHeader: false,
        //contentStyle: { 'max-height': '500px', overflow: 'auto' },
        height: '70',
        data: {
          selectedData: selectedData,
        },
        dismissableMask: true,
      }
    ));
    ref.onClose.subscribe((response) => {
      ref.destroy();
    });
    return ref;
  }

component 2

  onClose() {
    console.log('onclose');
    this.quoteDisplayFalse();
    this.ref.close();
  }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Add a console after "ref.onClose.subscribe((response) => { ". You will get the console being logged when you click outside the box. Here, you can also write another function being called upon close.

No need to do ref.destroy, as it will automatically close the dialog box.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!