I'm new to PrimeFaces. I'm using p:chips
component, I want to show a confirmation dialog before removing items from p:chips
. Is there a direct way to do that, or how can I listen to the removal event using Java bean or JavaScript callbacks.
Asked
Active
Viewed 532 times
1

Jasper de Vries
- 19,370
- 6
- 64
- 102

iKilany
- 71
- 10
-
1The short answer is there is no "pre" removal event hook. There is an p:ajax event="itemUnselect" for using ajax to received the removed item. To insert a hook for "pre" remove you will have to override the widget Javascript "removeItem" method which is an advanced topic like this: https://stackoverflow.com/questions/39639532/override-a-method-from-a-primefaces-specific-widget β Melloware Jun 19 '19 at 19:21
1 Answers
-1
you can use the onRemove property.
<p-chip onRemove="removeFilterClick($event)"></p-chip>
then make an function.
```javascript
removeFilterClick(event)
var ref = this.dialogService.open(ConfirmModalComponent, {
width: '650px',
contentStyle: { 'max-height': '500px', overflow: 'auto' },
styleClass: 'confirm-modal',
baseZIndex: 10000,
data: {
message: "Are you sure you want to delete ?",
successButtonText: 'Yes, Delete',
cancelButtonText: 'Cancel',
},
});

Niharika rathor
- 1
- 1
-
The question is about PrimeFaces (Java, JSF, Jakarta Server Faces). β Jasper de Vries Mar 14 '23 at 07:52
-
As itβs currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). β Community Mar 19 '23 at 04:17