0

I am working with RichFaces, and in an form for editing I can't get values of the element that I want to edit,

here is my code:

<!-- <h:outputText value="#{collaborateurBo.getAllCollaborateur().size()}" /> -->

    <ui:define name="content">
        <center>
            <a4j:status onstart="#{rich:component('statPane')}.show()"
                onstop="#{rich:component('statPane')}.hide()" />                
            <h:form id="form">
                <a4j:outputPanel id="tableaa" layout="block">
                    <rich:dataTable value="#{PosteBean.getCollaborateurList()}" var="pr" iterationStatusVar="it" id="table"rows="15">
                        <rich:column>
                            <f:facet name="header">#</f:facet> #{it.index} </rich:column>
                        <rich:column>
                    <f:facet name="header">Last name</f:facet>
                <h:outputText value="#{pr.getNom()}" /> 
                        </rich:column>
                        <rich:column>
                        <f:facet name="header">First name</f:facet>
                        <h:outputText value="#{pr.getPrenom()}" />
                        </rich:column>              
                    <rich:column>
            <a4j:commandLink styleClass="no-decor" execute="@this"render="@none"
            oncomplete="#{rich:component('confirmPane')}.show()">
        <h:graphicImage value="/css/images/delete.gif" alt="delete" />
    <a4j:param value="#{it.index}"
        assignTo="#{PosteBean.currentProjectIndex}" />
    <f:setPropertyActionListener target="#{PosteBean.Collab}"value="#{p}" />
                            </a4j:commandLink>
    <a4j:commandLink styleClass="no-decor" render="editGrid" execute="@this"
    oncomplete="#{rich:component('editPane')}.show()">
        <h:graphicImage value="/css/images/edit.gif" alt="edit" />

            <a4j:param value="#{it.index}"
                assignTo="#{PosteBean.currentProjectIndex}" />

    <f:setPropertyActionListener target="#{PosteBean.Collab}" value="#{p}" />
            </a4j:commandLink>                          
            </rich:column>                      
                     <f:facet name="footer">
            <rich:dataScroller id="scroller" />
             </f:facet>                     
                </rich:dataTable>
        <a4j:commandButton styleClass="no-decor" render="addGrid"
        oncomplete="#{rich:component('addPane1')}.show()"
                        value="Add new User">
                    </a4j:commandButton>                    
            </a4j:outputPanel>          
            <a4j:jsFunction name="remove" action="Collaborateurr.remove()"
                    render="tableaa" execute="@this"
                    oncomplete="#{rich:component('confirmPane')}.hide();" />            
            <rich:popupPanel id="statPane" autosized="true">
                    <h:graphicImage value="/css/images/ai.gif" alt="ai" />
            Please wait...
        </rich:popupPanel>       
        <rich:popupPanel id="confirmPane" autosized="true">
            Are you sure you want to delete the row?            
             <a4j:commandButton value="Cancel"
                        onclick="#{rich:component('confirmPane')}.hide(); return false;" />
                    <a4j:commandButton value="Delete" onclick="remove()" />
                </rich:popupPanel>   
</h:form>           
        <rich:popupPanel header="Edit User Details" id="editPane"
                    domElementAttachment="parent" width="400" height="200"> 
    <h:form id="form2">                 
                    <rich:graphValidator id="gvv">
                        <rich:messages for="gvv" />
                        <rich:messages globalOnly="true" />                     
                        <h:panelGrid columns="3" id="editGrid">
                           <h:outputText value="nom" />
                            <h:inputText value="#{PosteBean.collab.nom}" />
                            <h:panelGroup />
                            <h:outputText value="prenom" />
                            <h:inputText value="#{PosteBean.collab.prenom}" />
                        </h:panelGrid>                      
                        <h:selectOneRadio id="koko" value="PosteBean.sflag">
                            <f:selectItem itemValue="ROLE_ADMIN" itemLabel="Manager" />
                            <f:selectItem itemValue="ROLE_USER" itemLabel="Tester" />
                        </h:selectOneRadio>                     
                        <a4j:commandButton value="Store" action="PosteBean.store"
                            render="table" execute="editPane"
                            oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('editPane')}.hide();}" />                      
                        <a4j:commandButton value="Cancel"
                            onclick="#{rich:component('editPane')}.hide(); return false;" />                            
                    </rich:graphValidator>
</h:form> 
                </rich:popupPanel>          
            <rich:popupPanel header="Add User " id="addPane1"
                    domElementAttachment="parent" width="400" height="200">
                    <rich:graphValidator id="gv">
                        <rich:messages for="gv" />
                        <rich:messages globalOnly="true" />
                        <h:panelGrid columns="3" id="addGrid">
                            <h:outputText value="Last name" />
                            <h:inputText value="#{PosteBean.collab.nom}" />
                            <h:panelGroup />
                            <h:outputText value="First name" />
                        <h:inputText value="#{PosteBean.collab.prenom}" /> 
                            <h:panelGroup />

                        </h:panelGrid>                  
                        <h:selectOneRadio id="kokoo" value="#{PosteBean.sflag}">
                            <f:selectItem itemValue="ROLE_ADMIN" itemLabel="Manager" />
                            <f:selectItem itemValue="ROLE_USER" itemLabel="Tester" />

                        </h:selectOneRadio>

                        <a4j:commandButton value="Add" action="#{PosteBean.add}"
                            render="table" execute="addPane1"
                            oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('addPane1')}.hide();}" />

                        <a4j:commandButton value="Cancel"
                            onclick="#{rich:component('addPane1')}.hide(); return false;" />
                    </rich:graphValidator>

                </rich:popupPanel>  

        </center>
    </ui:define>

</ui:composition>

Thanks in advance for helping me, i wanna have values and edit them in the form

Vasil Lukach
  • 3,658
  • 3
  • 31
  • 40
  • the form where i use CollaborateurList is working well, the pb is when i click to edit i have a empty form for editing – user3315885 Feb 18 '14 at 23:03
  • See [my answer](http://stackoverflow.com/questions/21149141/richfaces-show-details-in-popup-commandbutton-action-and-popuppanel/21149308#21149308) for question `Richfaces: show details in popup [commandbutton, action and popupPanel]` – Vasil Lukach Feb 19 '14 at 03:36
  • i read your answer, it is better if you help me please find wich the source of the pb in the code i give, – user3315885 Feb 19 '14 at 13:00
  • `a4j:commandLink` with `f:setPropertyActionListener` works fine in JSF 1.2 and RichFaces 3.3.x, but not really good in JSF 2.x and RichFaces 4.x. I propose change your code as it is in answer in my previous comment. – Vasil Lukach Feb 19 '14 at 14:37
  • thx Vasil i solved the pb in my code:) – user3315885 Feb 19 '14 at 23:56

0 Answers0