0

As mentioned in primefaces showcase we can easily get the items from transfer event in the backing bean. However I need the items in my javascript function, as I need to add a css class after each item has been transfered to the target.

This is my xhtml:

 <p:pickList id="PojoPickList" value="#{pickListView.themes}" var="theme" effect="bounce"
                    itemValue="#{theme}" itemLabel="#{theme.displayName}" showSourceControls="true" showTargetControls="true" showCheckbox="true" responsive="true"
                    showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains" converter="theme">    
    ...
      <p:ajax event="transfer" oncomplete="onTransfer(event);" />
    ...

and javascript function:

function onTransfer(event) {
    console.log(event);
}

But the event is undefined.Thanks.

nolazem
  • 45
  • 5
  • change oncomplete with onclick and the event will be onclick – Yagami Light Feb 21 '17 at 10:36
  • please read the answer that i give in [this](http://stackoverflow.com/questions/42107052/primefaces-commandbutton-conditional-statement/42107714#42107714) it will give you more informations to understand why it doesn't work – Yagami Light Feb 21 '17 at 10:41
  • Thanks but onclick is not really what I need and I do not want to get any value from backing bean. There should be a way to get the items which will be transfered on client side. – nolazem Feb 21 '17 at 11:35
  • What is it you want to accomplish, why do you need to add a class? Do all transferred items need to look different or what? – Jaqen H'ghar Feb 22 '17 at 08:12
  • Yes, the transfered items are table columns. They should get an icon to show how they should be ordered, asc or desc. – nolazem Feb 22 '17 at 09:00

1 Answers1

0

I could solve the problem by overwriting the fireTransferEvent function in picklist.js of primeface. In this event, I have added the css classes, which I need. Now the items will get the css after transfering to the target list.

nolazem
  • 45
  • 5