1

can <f:setPropertyActionListener> be used in primefaces datatable rowExpansion? I tried

<p:ajax event="rowToggle" listener="#{queryStudiesBean.onRowToggle}" >
      <f:setPropertyActionListener target="#{queryPatientBean.test}" value="sucess"/>
</p:ajax>

but it says

<f:setPropertyActionListener> Parent is not of type ActionSource

also I tried

<p:rowToggler>
    <f:setPropertyActionListener target="#{queryPatientBean.test}" value="sucess"/>
</p:rowToggler>

but it gives the same error, is there anyway to use it?

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
zyydoosh
  • 387
  • 2
  • 14

2 Answers2

1

<f:setPropertyActionListener> works with ActionSource components like <p:commandLink> and <p:commandButton>.

<p:rowExpansion>
   <p:commandLink>
      <f:setPropertyActionListener>
   </p:commandLink>
</p:rowExpansion>
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 11 '22 at 18:31
0

I knew how to do it finally, I put the <f:setPropertyActionListener> inside remoteCommand, which in turn needs to be inside a form:

<form>
      <p:remoteCommand name="callButton" ajax="false" id="callButton" action="#{queryPatientBean.printTest()}">
           <f:setPropertyActionListener target="#{queryPatientBean.test}" value="success"/>
      </p:remoteCommand>
</form>

then I called this remoteCommand from <p:ajax> onstart:

<p:ajax event="rowToggle" onstart="callButton();" listener="#{queryStudiesBean.onRowToggle}" />
zyydoosh
  • 387
  • 2
  • 14