Reputation: 736
I have a picklist component (Primefaces 6.x ) in one of my pages. The picklist has a "transfer" event listener as shown in the showcase:
<p:ajax event="transfer" listener="#{pickListView.onTransfer}" update="msg" />
This works pretty well and my method is called every time i add or remove items from the target list.
My question is if it is possible to trigger the event handler only when adding items in the target list or if there is a way to catch the remove from target action in my method and ignore all validations that i am doing in bean method.
Upvotes: 2
Views: 3391
Reputation: 12337
There is an advantage to source being open and having a good IDE for code completion. Both can show that the TransferEvent.java
has isAdd()
and isRemove()
methods. These can easily be used to differentiate in an eventHandler which one is actually used.
public void onTransfer(TransferEvent event) {
if (event.isAdd()) {
// Do actual work
}
}
Upvotes: 6