2

I'm trying to learn primefaces, and I want to display an orderList and when an item is clicked, a pickList is refreshed using ajax. My problem is that when I click on an item, primefaces doesn't access to the function in the managedBean. And it's like nothing is happening.

My XHTML :

<p:panel style="width:100%">
    <p:panelGrid style="width:100%" columns="3">
        <p:panel header="Collaborateurs">
            <p:orderList  value="#{affectationRolesBean.collaborateursList()}"
                var="collaborateur" controlsLocation="none"
                itemLabel="#{collaborateur}" itemValue="#{collaborateur}">
                <p:ajax event="select" listener="#{affectationRolesBean.onSelect}"
                    process="@form"/>
            </p:orderList>
        </p:panel>
        <p:pickList style="height:600px" id="pickList" value="#{affectationRolesBean.roles}"
            var="role" itemLabel="#{role.libele}" itemValue="role.libele">
            <f:facet name="sourceCaption">Roles Non affectés</f:facet>
            <f:facet name="targetCaption">Roles Affectés</f:facet>
        </p:pickList>
    </p:panelGrid>
    <p:commandButton value="Affecter"
        actionListener="#{affectationRolesBean.affecterRolesToCollaborateur()}" />
</p:panel>

My managedBean :

public void onSelect(SelectEvent event){
    selectedCollaborateurName = event.getObject().toString();
    selectedCollaborateur=this.getCollaborateurByName(selectedCollaborateurName);
    roles.setSource(roleService.getRolesNotAffected(selectedCollaborateur));
    roles.setTarget(selectedCollaborateur.getRoles());
}
Vasil Lukach
  • 3,658
  • 3
  • 31
  • 40
aboamin12
  • 113
  • 9

0 Answers0