Primeng: Multiple Confirmation Dialogs in an Application Cause Issues

Created on 12 Mar 2018  路  2Comments  路  Source: primefaces/primeng

I'm submitting a ...

[x] bug report
[ ] feature request
[ ] support request

Plunkr Case (Bug Reports)
No Plunkr Case is provided because this is fairly easily explained.

Current behavior
If a user wants 2 confirmation dialogs with different purposes, he must currently use the same acceptLabel and rejectLabel. Labels cannot be set in the confirmationService.confirm() function, and if the user adds two <p-confirmDialog> tags on the same page both of them pop up when the confirmation service is called.

Expected behavior
The user should be able to specify acceptLabel and rejectLabel in TypeScript rather than being forced to do so in HTML, since multiple <p-confirmDialog> tags cannot be used on the same page

What is the motivation / use case for changing the behavior?
Multiple dialogs of different purposes on the same page, with different accept/reject labels (for example, a 'log out' confirmation and a 'send email' confirmation)

  • Angular version: 5.1.3

  • PrimeNG version: 5.2.1

  • Browser: all

Most helpful comment

I don't think that this is bug. You can use multiple confirm dialog boxes. The key to success is property key.

If you set the dialog key property you can have multiple confirm dialog boxes and you can set their property independently.

Demo http://plnkr.co/edit/zT4F2SbdPzjl7Jfu2IdW?p=preview

You are right that you can not set acceptLabel and rejectLabel as confirm method parameter. Fortunately simple workaround exists (see the demo - Set label from code). I use dialog property confirmation which contains whole configuration object (passed to confirm method). Unfortunately the confirmation property is not declared as public API.

I think that confirmation dialog should have the possiblity to set property rejectIcon, acceptIcon, rejectLabel and acceptLabel via confirmation object too, but it is feature request and not a bug.

All 2 comments

I don't think that this is bug. You can use multiple confirm dialog boxes. The key to success is property key.

If you set the dialog key property you can have multiple confirm dialog boxes and you can set their property independently.

Demo http://plnkr.co/edit/zT4F2SbdPzjl7Jfu2IdW?p=preview

You are right that you can not set acceptLabel and rejectLabel as confirm method parameter. Fortunately simple workaround exists (see the demo - Set label from code). I use dialog property confirmation which contains whole configuration object (passed to confirm method). Unfortunately the confirmation property is not declared as public API.

I think that confirmation dialog should have the possiblity to set property rejectIcon, acceptIcon, rejectLabel and acceptLabel via confirmation object too, but it is feature request and not a bug.

This makes sense, thank you. I overlooked the 'key' property when digging into the documentation. As this is not a valid bug report then, I suppose it can be closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Helayxa picture Helayxa  路  3Comments

jisqaqov picture jisqaqov  路  3Comments

KannanMuruganmony picture KannanMuruganmony  路  3Comments

Helayxa picture Helayxa  路  3Comments

mitosandov picture mitosandov  路  3Comments