如何在p:chips中监听物品移除事件?

问题描述 投票:0回答:1

我是 PrimeFaces 的新手。我正在使用

p:chips
组件,我想在从 p:chips 中删除项目之前显示一个确认对话框。有没有直接的方法可以做到这一点,或者我如何使用 Java bean 或 JavaScript 回调来监听删除事件。

javascript jsf primefaces
1个回答
-1
投票

你可以使用 onRemove 属性。

<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',
  },
  });
© www.soinside.com 2019 - 2024. All rights reserved.