0 Replies Latest reply on Apr 25, 2012 12:00 AM by nguyen tung son

    update instructions in the dialog richfaces.

    nguyen tung son Newbie

      I am having difficulty in <rich:modelPanel> update. id not get on.
      Expect people to help. thank you all.

       

       

                     

      <h:form>

                                          <a4j:keepAlive beanName="nvBean" ajaxOnly="true"/>

       

                                                  <rich:dataTable value="#{nvBean.allNhanVien}" var="varlist" rows="5" rowKeyVar="row" ajaxKeys="#{nvBean.rowstoupdate}">

       

                                                      <h:column>

                                                          <f:facet name="header"> <h:selectBooleanCheckbox></h:selectBooleanCheckbox></f:facet>

                                                          <h:selectBooleanCheckbox></h:selectBooleanCheckbox>              

                                                      </h:column>

                                                      <rich:column>

                                                          <f:facet name="header">

                                                              <h:outputLabel value="STT"/>

                                                          </f:facet>

                                                          <h:outputLabel value="#{row+1}"/>

                                                      </rich:column>

                                                      <rich:column>

                                                          <f:facet name="header"><h:outputText value="ID" /></f:facet>

                                                          <h:outputLabel value="#{varlist.nv_id}" id="id"   />                 

                                                      </rich:column>

                                                      <rich:column>

                                                          <f:facet name="header"><h:outputText value="Name Employee" /></f:facet>

                                                          <h:outputText value="#{varlist.nv_name}"     />                 

                                                      </rich:column>

                                                      <rich:column>

       

                                                      </rich:column>

                                                      <rich:column>

                                                          <f:facet name="header"><h:outputText value="Address Employee" /></f:facet>

                                                          <h:outputText value="#{varlist.nv_address}"     />                 

                                                      </rich:column>

                                                      <rich:column>

                                                          <f:facet name="header"><h:outputText value="Mail Employee" /></f:facet>

                                                          <h:outputText value="#{varlist.nv_email}"     />                 

                                                      </rich:column>

                                                      <rich:column>

                                                          <f:facet name="header"><h:outputText value="Location Employee" /></f:facet>

                                                          <h:outputText value="#{varlist.nv_location}"     />                 

                                                      </rich:column>

                                                      <rich:column>

                                                          <f:facet name="header"><h:outputText value="Controler" /></f:facet>

                                                          <h:commandLink value="Delete" action="#{nvBean.deleteNhanVien(varlist.nv_id)}"  onclick="confirm('Do you want to delete this data?')"/>

                                                          <a4j:commandLink id="editlink" oncomplete="#{rich:component('editPanel')}.show()">

                                                              <f:param value="#{varlist.nv_id}" name="nvid" /> 

                                                              <h:graphicImage value="../images/edit.gif" style="border:0" />

                                                              <h:outputLabel value="Edit"></h:outputLabel>

                                                              <f:setPropertyActionListener value="#{varlist}" target="#{nvBean.nhanvien}" /> 

       

       

                                                          </a4j:commandLink>

                                                          <rich:toolTip for="editlink" value="Name : #{varlist.nv_id}" />

                                         </rich:dataTable>

      </h:form>

       

      <h:form>

                                          <rich:modalPanel id="editPanel" autosized="true" width="600">

                                              <f:facet name="header">

                                                  <h:outputText value="Inromation Edit Employees" />

                                              </f:facet>                                      

                                              <a4j:outputPanel ajaxRendered="true">

                                                  <h:panelGrid columns="2">

                                                      <h:outputText value="Id Employee:" />

                                                      <h:outputLabel value="#{nvBean.nhanvien.nv_id}"/>                                          

                                                      <h:outputText value="Name Employee:" />

                                                      <h:inputText value="#{nvBean.nhanvien.nv_name}" />

                                                      <h:outputText value="Address Employee:" />

                                                      <h:inputText value="#{nvBean.nhanvien.nv_address}"/>

                                                      <h:outputText value="Email Employee:" />

                                                      <h:inputText value="#{nvBean.nhanvien.nv_email}" />

                                                      <h:outputText value="Location Employee:" />

                                                      <h:inputText value="#{nvBean.nhanvien.nv_location}" />

                                                  </h:panelGrid>

                                              </a4j:outputPanel> 

                                              <h:panelGrid columns="2">

                                                  <a4j:commandLink value="Close" onclick="#{rich:component('modalPanel')}.hide()" />

                                                  <a4j:commandLink value="Update"

                                                                   actionListener="#{nvBean.updateNhanVien}"

                                                                   reRender="userinfo"

                                                                   oncomplete="if (#{facesContext.maximumSeverity==null})

                                                                   #{rich:component('editPanel')}.hide();" >

                                                  </a4j:commandLink>

                                              </h:panelGrid>

                                          </rich:modalPanel>

                                      </h:form>

       

       

      This is NhanVienBean

       

      public void updateNhanVien() { 

              Session ss = sf.openSession(); 

              ss.beginTransaction().begin(); 

              ss.update(this.nhanvien); 

              ss.flush(); 

              ss.beginTransaction().commit(); 

              ss.close(); 

               

          }