ConfirmDialog on close should NOT act as reject - Reverse of #921
I'm submitting a ... (check one with "x")
[ ] bug report => Search github for a similar issue or PR before submitting
[x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Current behavior Since 4.1.0 and #921 , when escape button of confirm dialog is clicked, the reject method of reject button is invocked.
Expected behavior I think the escape button and the reject button should not have the same behavior because:
- click on the 'No' button means reject the action
- however escape the dialog means go back to the previous state
So the escape button should not start the reject method. No ? At least, the close event can be exposed to invoked a method.
Minimal reproduction of the problem with instructions
https://www.primefaces.org/primeng/#/confirmdialog
- PrimeNG version: 4.1.0
General and popular feedback was rejecting it on close, if more users demand not rejecting it, we'll introduce an attribute to make this customizable.
Okay, I understand. Is there a way to detect if it's a close event from the cross click or from the no button in the reject method ?
i have the same question, is there a way to detect the close event? we would like to handle close and reject event separately.
I agree, this should be parametrized.
Any update to make a reject option as parameterized to differentiate between close and reject ?
Close button should only close the dialog. And the rejection button that must be an action.
You can differentiate between closing and rejecting in the reject callback function:
reject: (button: number) => {
if (button === 2) {
// handle close
return;
}
// handle reject
},
As far as I could tell this is not documented anywhere.