Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you pass a value into an ajax listener primefaces

So I have

<p:ajax event="tabChange" listener="#{refriedBean.onTabChange}" />

But I want to pass in the tabChange event AND an extra value that is stored on the page

public void onTabChange(TabChangeEvent event, Object obj)

How would one go about doing this?

like image 564
Landister Avatar asked Feb 27 '12 21:02

Landister


1 Answers

You can replace argument obj with additional property in bean and set needed value to this property on ajax request:

<p:ajax event="tabChange" listener="#{refriedBean.onTabChange}">
  <f:setPropertyActionListener target="#{refriedBean.additionalProperty}" value="value_here"/>
</p:ajax>

See setPropertyActionListener

like image 153
Mikita Belahlazau Avatar answered Oct 13 '22 19:10

Mikita Belahlazau