set setPropertyActionListener inside a composite component

Viewed 15

I just want to use the setPropertyActionListener inside my composite component, but the value in the target of PropertyActionListener stays null.

<composite:interface>
  <composite:attribute name="listOfUsers" required="true"/>
  <composite:attribute name="selectedUser" required="true"/>
  <composite:attribute name="actionDelete" required="true" method-signature="void action()"/>
</composite:interface>
        
<composite:implementation>
   <h:form>
      <p:dataTable widgetVar="usersTable" var="user" value="#{cc.attrs.listOfUsers}" reflow="true" styleClass="products-table" selection="#{cc.attrs.selectedUser}" rowKey="#{c.uniqueName}">
         <p:column headerText="Email" sortBy="#{user.email}" filterBy="#{user.email}" filterMatchMode="contains">
            <h:outputText value="#{user.email}"/>
          </p:column>
          <p:column width="80" exportable="false">
             <p:commandButton icon="pi pi-trash" style="width: 50%;" oncomplete="PF('unshareUserDialog').show()">
                 <f:setPropertyActionListener value="#{user}" target="#{cc.attrs.selectedUser}" />
              </p:commandButton>
          </p:column>
        
       </p:dataTable>
   </h:form>
        
   <p:confirmDialog widgetVar="unshareUserDialog" showEffect="fade" width="300" message="Unshare User?" header="Confirm" severity="warn">
      <p:commandButton id="unshareYes" value="Yes" icon="pi pi-check" action="#{cc.attrs.actionDelete}" oncomplete="PF('unshareUserDialog').hide()" />
      <p:commandButton value="No" icon="pi pi-times" onclick="PF('unshareUserDialog').hide()"/>
   </p:confirmDialog>
</composite:implementation>

i tried the proposed solution from @BalusC in this link [https://stackoverflow.com/questions/12529353/can-i-use-fsetpropertyactionlistener-inside-an-autocomplete-component][1]

[1]: Can I use <f:setPropertyActionListener> inside an autoComplete component? by adding the following lines to my composite component, but the value of the targets stays null.

<composite:interface>
   <composite:actionSource name="actionYes" targets="unshareYes"/>
</composite:interface>
    
<p:commandButton icon="pi pi-trash" style="width: 50%;" oncomplete="PF('unshareUserDialog').show()"> 
       <f:setPropertyActionListener for="actionYes" value="#{user}" target="#{cc.attrs.selectedUser}"/>
</p:commandButton>
    
<p:confirmDialog widgetVar="unshareUserDialog" showEffect="fade" width="300"
                    message="Unshare User?" header="Confirm" severity="warn">
            <p:commandButton id="unshareYes" value="Yes" icon="pi pi-check" action="#{cc.attrs.actionDelete}"
                             oncomplete="PF('unshareUserDialog').hide()" />
            <p:commandButton value="No" icon="pi pi-times" onclick="PF('unshareUserDialog').hide()"/>
 </p:confirmDialog>

could you please tell me, what i am missing here?

0 Answers
Related