3 Replies Latest reply on Dec 5, 2009 4:07 PM by Palani swamy

    How to the select datatable row value in ModalPanel

    Palani swamy Newbie
      hi
            how to load the selected datatable row value in modalpanel


      this is my code

        <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:a="http://richfaces.org/a4j"
          template="../layout/NewRequestDesignProcessDetails.xhtml">

      <ui:define name="body">
      <h:form>
      <ui:include src="../layout/NewRequestDetailsViewTemplete.xhtml"/>
      <rich:panel>
                  <f:facet name="header">#{messages.lblFinalDeliveryRequest}</f:facet>
      <rich:dataTable var="_dgnRequestJobDetails"
                         value="#{dgnFinalDeliveryHome.GetDgnFinalDeliveryView()}" rowKeyVar="rowKey"
                      rendered="#{dgnFinalDeliveryHome.GetDgnFinalDeliveryView()!= null}"
                    id="dgnRequestJobDetailsTable">
              
                    <rich:column >
                                   <f:facet name="header">S.No.</f:facet>
                                     <h:outputText value="#{rowKey+1}"   />
                   </rich:column>
              
                  <h:column>
                      <f:facet name="header">#{messages.lblDescription}</f:facet>
                      <h:outputText value="#{_dgnRequestJobDetails.productDescription}"/>
                  </h:column>
                  <h:column>
                      <f:facet name="header">#{messages.lblProductVersion}</f:facet>
                      <h:outputText value="#{_dgnRequestJobDetails.productVersion}"/>
                  </h:column>
                  <h:column>
                      <f:facet name="header">#{messages.lblRemarks}</f:facet>
                      <h:outputText value="#{_dgnRequestJobDetails.remarks}"/>
                  </h:column>
                 
                  <h:column>
                      <f:facet name="header">#{messages.lblResponsiblePerson}</f:facet>
                      <h:outputText value="#{_dgnRequestJobDetails.responsiblePersonId}"/>
                  </h:column>
                 
                  <h:column>
                      <f:facet name="header">#{messages.lblTargetDate}</f:facet>
                      <h:outputText value="#{_dgnRequestJobDetails.targetDate}">
                      <s:convertDateTime type="date" dateStyle="short" pattern="dd-MM-yyyy"></s:convertDateTime>
                      </h:outputText>
                                       </h:column>
              </rich:dataTable>
      </rich:panel>
      <rich:panel>
              <f:facet name="header">#{messages.lblFinalDeliveryUpdate}</f:facet>
          <div class="results" id="dgnFinalDeliveryList">


      <rich:dataTable id="dgnFinalDeliveryList"
                      var="_dgnFinalDelivery"
                      rowKeyVar="rowKey"
                    value="#{dgnFinalDeliveryList.resultList}"
                 rendered="#{not empty dgnFinalDeliveryList.resultList}">
             
                   <rich:column>
                    <f:facet name="header">S.No.</f:facet>
                    <h:outputText value="#{rowKey+1}"   />
                   </rich:column>
             
              <h:column>
                  <f:facet name="header">
                      <ui:include src="../layout/sort.xhtml">
                          <ui:param name="entityList" value="#{dgnFinalDeliveryList}"/>
                          <ui:param name="propertyLabel" value="Product description"/>
                          <ui:param name="propertyPath" value="dgnFinalDelivery.productDescription"/>
                      </ui:include>
                  </f:facet>
                  <h:outputText value="#{_dgnFinalDelivery.productDescription}"/>
              </h:column>
              <h:column>
                  <f:facet name="header">
                      <ui:include src="../layout/sort.xhtml">
                          <ui:param name="entityList" value="#{dgnFinalDeliveryList}"/>
                          <ui:param name="propertyLabel" value="Product version"/>
                          <ui:param name="propertyPath" value="dgnFinalDelivery.productVersion"/>
                      </ui:include>
                  </f:facet>
                  <h:outputText value="#{_dgnFinalDelivery.productVersion}"/>
              </h:column>
              <h:column>
                  <f:facet name="header">
                      <ui:include src="../layout/sort.xhtml">
                          <ui:param name="entityList" value="#{dgnFinalDeliveryList}"/>
                          <ui:param name="propertyLabel" value="Remarks"/>
                          <ui:param name="propertyPath" value="dgnFinalDelivery.remarks"/>
                      </ui:include>
                  </f:facet>
                  <h:outputText value="#{_dgnFinalDelivery.remarks}"/>
              </h:column>
             
              <h:column>
                  <f:facet name="header">
                      <ui:include src="../layout/sort.xhtml">
                          <ui:param name="entityList" value="#{dgnFinalDeliveryList}"/>
                          <ui:param name="propertyLabel" value="Responsible person id"/>
                          <ui:param name="propertyPath" value="dgnFinalDelivery.responsiblePersonId"/>
                      </ui:include>
                  </f:facet>
                  <h:outputText value="#{dgnRequestMasterHome.getEmployeeNameById(_dgnFinalDelivery.requestedBy)}"/>
              </h:column>
           
           
              <rich:column styleClass="action">
                  <f:facet name="header">Action</f:facet>
                 
                  <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                      <tr>
                                               <td width="10%;" align="left"    
                                                      <h:outputLink  id="uploadFU" name="dgnFinalDeliveryFinalDeliveryId"   value="#{_dgnFinalDelivery.finalDeliveryId)}">
                                                              <img src="../img/add.png" border="0" align="left"/>
                                                                      <label><b>Upload</b></label>
                                                              <rich:componentControl for="fileupload" attachTo="uploadFU" operation="show" event="onclick">
                                                              <f:param name="dgnFinalDeliveryFinalDeliveryId"   value="#{_dgnFinalDelivery.finalDeliveryId)}" />
                                                      </rich:componentControl>
                                                      </h:outputLink>
                                             
                                              </td>
                                      </tr>
                              </table>
                              <br />           
                  <s:link view="/request/DgnFinalDelivery.xhtml"
                         value="#{empty from ? 'View' : 'Select'}"
                   propagation="#{empty from ? 'none' : 'default'}"
                            id="dgnFinalDelivery">
                      <f:param name="dgnFinalDeliveryFinalDeliveryId"
                              value="#{_dgnFinalDelivery.finalDeliveryId}"/>
                  </s:link>
               
                  #{' '}
                  <s:link view="/request/DgnFinalDeliveryEdit.xhtml"
                         value="Edit"
                   propagation="none"
                            id="dgnFinalDeliveryEdit"
                      rendered="#{empty from}">
                      <f:param name="dgnFinalDeliveryFinalDeliveryId"
                              value="#{_dgnFinalDelivery.finalDeliveryId}"/>
                             
                                  <f:param name="dgnRequestJobDetailsJobId"
                                      value="#{dgnRequestJobDetailsHome.dgnRequestJobDetailsJobId}"/>
                                      <f:param name="dgnRequestMasterRequestId"
                                         value="#{dgnRequestMasterHome.dgnRequestMasterRequestId}"/>
                             
                  </s:link>
             </rich:column>
          </rich:dataTable>

          </div>
          </rich:panel>
      </h:form>
          <div class="tableControl">

              <s:link view="/DgnFinalDeliveryList.xhtml"
                  rendered="#{dgnFinalDeliveryList.previousExists}"
                     value="#{messages.left}#{messages.left} First Page"
                        id="firstPage">
                <f:param name="firstResult" value="0"/>
              </s:link>

              <s:link view="/DgnFinalDeliveryList.xhtml"
                  rendered="#{dgnFinalDeliveryList.previousExists}"
                     value="#{messages.left} Previous Page"
                        id="previousPage">
                  <f:param name="firstResult"
                          value="#{dgnFinalDeliveryList.previousFirstResult}"/>
              </s:link>

              <s:link view="/DgnFinalDeliveryList.xhtml"
                  rendered="#{dgnFinalDeliveryList.nextExists}"
                     value="Next Page #{messages.right}"
                        id="nextPage">
                  <f:param name="firstResult"
                          value="#{dgnFinalDeliveryList.nextFirstResult}"/>
              </s:link>

              <s:link view="/DgnFinalDeliveryList.xhtml"
                  rendered="#{dgnFinalDeliveryList.nextExists}"
                     value="Last Page #{messages.right}#{messages.right}"
                        id="lastPage">
                  <f:param name="firstResult"
                          value="#{dgnFinalDeliveryList.lastFirstResult}"/>
              </s:link>

          </div>

      <f:subview> 
               <rich:modalPanel id="fileupload" width="850" height="400">
             <f:facet name="header">
                  <h:panelGroup>
                      <h:outputText value="Upload Details"></h:outputText>
                  </h:panelGroup>
              </f:facet>
             
              <f:facet name="controls">
                  <h:panelGroup>
                         <h:graphicImage value="../img/cancel.png"  id="cancel" />
                                          <rich:componentControl for="fileupload" attachTo="cancel" operation="hide" event="onclick"/>
                               </h:panelGroup>
              </f:facet>
             <ui:include src="/request/FinalDeliveryUploadEdit.xhtml" >
            </ui:include> 
       
      </rich:modalPanel>
      </f:subview>
      </ui:define>
      </ui:composition>
        • 1. Re: How to the select datatable row value in ModalPanel
          Palani swamy Newbie
          <blockquote>
          _Jack Lu wrote on Dec 02, 2009 10:07:_<br/>

          hi
                how to load the selected datatable row value in modalpanel


          this is my code

            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <ui:composition xmlns="http://www.w3.org/1999/xhtml"
              xmlns:s="http://jboss.com/products/seam/taglib"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:rich="http://richfaces.org/rich"
              xmlns:a="http://richfaces.org/a4j"
              template="../layout/NewRequestDesignProcessDetails.xhtml">

          <ui:define name="body">
          <h:form>
          <ui:include src="../layout/NewRequestDetailsViewTemplete.xhtml"/>
          <rich:panel>
                      <f:facet name="header">#{messages.lblFinalDeliveryRequest}</f:facet>
          <rich:dataTable var="_dgnRequestJobDetails"
                             value="#{dgnFinalDeliveryHome.GetDgnFinalDeliveryView()}" rowKeyVar="rowKey"
                          rendered="#{dgnFinalDeliveryHome.GetDgnFinalDeliveryView()!= null}"
                        id="dgnRequestJobDetailsTable">
                  
                        <rich:column >
                                       <f:facet name="header">S.No.</f:facet>
                                         <h:outputText value="#{rowKey+1}"   />
                       </rich:column>
                  
                      <h:column>
                          <f:facet name="header">#{messages.lblDescription}</f:facet>
                          <h:outputText value="#{_dgnRequestJobDetails.productDescription}"/>
                      </h:column>
                      <h:column>
                          <f:facet name="header">#{messages.lblProductVersion}</f:facet>
                          <h:outputText value="#{_dgnRequestJobDetails.productVersion}"/>
                      </h:column>
                      <h:column>
                          <f:facet name="header">#{messages.lblRemarks}</f:facet>
                          <h:outputText value="#{_dgnRequestJobDetails.remarks}"/>
                      </h:column>
                     
                      <h:column>
                          <f:facet name="header">#{messages.lblResponsiblePerson}</f:facet>
                          <h:outputText value="#{_dgnRequestJobDetails.responsiblePersonId}"/>
                      </h:column>
                     
                      <h:column>
                          <f:facet name="header">#{messages.lblTargetDate}</f:facet>
                          <h:outputText value="#{_dgnRequestJobDetails.targetDate}">
                          <s:convertDateTime type="date" dateStyle="short" pattern="dd-MM-yyyy"></s:convertDateTime>
                          </h:outputText>
                                           </h:column>
                  </rich:dataTable>
          </rich:panel>
          <rich:panel>
                  <f:facet name="header">#{messages.lblFinalDeliveryUpdate}</f:facet>
              <div class="results" id="dgnFinalDeliveryList">


          <rich:dataTable id="dgnFinalDeliveryList"
                          var="_dgnFinalDelivery"
                          rowKeyVar="rowKey"
                        value="#{dgnFinalDeliveryList.resultList}"
                     rendered="#{not empty dgnFinalDeliveryList.resultList}">
                 
                       <rich:column>
                        <f:facet name="header">S.No.</f:facet>
                        <h:outputText value="#{rowKey+1}"   />
                       </rich:column>
                 
                  <h:column>
                      <f:facet name="header">
                          <ui:include src="../layout/sort.xhtml">
                              <ui:param name="entityList" value="#{dgnFinalDeliveryList}"/>
                              <ui:param name="propertyLabel" value="Product description"/>
                              <ui:param name="propertyPath" value="dgnFinalDelivery.productDescription"/>
                          </ui:include>
                      </f:facet>
                      <h:outputText value="#{_dgnFinalDelivery.productDescription}"/>
                  </h:column>
                  <h:column>
                      <f:facet name="header">
                          <ui:include src="../layout/sort.xhtml">
                              <ui:param name="entityList" value="#{dgnFinalDeliveryList}"/>
                              <ui:param name="propertyLabel" value="Product version"/>
                              <ui:param name="propertyPath" value="dgnFinalDelivery.productVersion"/>
                          </ui:include>
                      </f:facet>
                      <h:outputText value="#{_dgnFinalDelivery.productVersion}"/>
                  </h:column>
                  <h:column>
                      <f:facet name="header">
                          <ui:include src="../layout/sort.xhtml">
                              <ui:param name="entityList" value="#{dgnFinalDeliveryList}"/>
                              <ui:param name="propertyLabel" value="Remarks"/>
                              <ui:param name="propertyPath" value="dgnFinalDelivery.remarks"/>
                          </ui:include>
                      </f:facet>
                      <h:outputText value="#{_dgnFinalDelivery.remarks}"/>
                  </h:column>
                 
                  <h:column>
                      <f:facet name="header">
                          <ui:include src="../layout/sort.xhtml">
                              <ui:param name="entityList" value="#{dgnFinalDeliveryList}"/>
                              <ui:param name="propertyLabel" value="Responsible person id"/>
                              <ui:param name="propertyPath" value="dgnFinalDelivery.responsiblePersonId"/>
                          </ui:include>
                      </f:facet>
                      <h:outputText value="#{dgnRequestMasterHome.getEmployeeNameById(_dgnFinalDelivery.requestedBy)}"/>
                  </h:column>
               
               
                  <rich:column styleClass="action">
                      <f:facet name="header">Action</f:facet>
                     
                      <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                          <tr>
                                                   <td width="10%;" align="left"    
                                                          <h:outputLink  id="uploadFU" name="dgnFinalDeliveryFinalDeliveryId"   value="#{_dgnFinalDelivery.finalDeliveryId)}">
                                                                  <img src="../img/add.png" border="0" align="left"/>
                                                                          <label><b>Upload</b></label>
                                                                  <rich:componentControl for="fileupload" attachTo="uploadFU" operation="show" event="onclick">
                                                                  <f:param name="dgnFinalDeliveryFinalDeliveryId"   value="#{_dgnFinalDelivery.finalDeliveryId)}" />
                                                          </rich:componentControl>
                                                          </h:outputLink>
                                                 
                                                  </td>
                                          </tr>
                                  </table>
                                  <br />           
                      <s:link view="/request/DgnFinalDelivery.xhtml"
                             value="#{empty from ? 'View' : 'Select'}"
                       propagation="#{empty from ? 'none' : 'default'}"
                                id="dgnFinalDelivery">
                          <f:param name="dgnFinalDeliveryFinalDeliveryId"
                                  value="#{_dgnFinalDelivery.finalDeliveryId}"/>
                      </s:link>
                   
                      #{' '}
                      <s:link view="/request/DgnFinalDeliveryEdit.xhtml"
                             value="Edit"
                       propagation="none"
                                id="dgnFinalDeliveryEdit"
                          rendered="#{empty from}">
                          <f:param name="dgnFinalDeliveryFinalDeliveryId"
                                  value="#{_dgnFinalDelivery.finalDeliveryId}"/>
                                 
                                      <f:param name="dgnRequestJobDetailsJobId"
                                          value="#{dgnRequestJobDetailsHome.dgnRequestJobDetailsJobId}"/>
                                          <f:param name="dgnRequestMasterRequestId"
                                             value="#{dgnRequestMasterHome.dgnRequestMasterRequestId}"/>
                                 
                      </s:link>
                 </rich:column>
              </rich:dataTable>

              </div>
              </rich:panel>
          </h:form>
              <div class="tableControl">

                  <s:link view="/DgnFinalDeliveryList.xhtml"
                      rendered="#{dgnFinalDeliveryList.previousExists}"
                         value="#{messages.left}#{messages.left} First Page"
                            id="firstPage">
                    <f:param name="firstResult" value="0"/>
                  </s:link>

                  <s:link view="/DgnFinalDeliveryList.xhtml"
                      rendered="#{dgnFinalDeliveryList.previousExists}"
                         value="#{messages.left} Previous Page"
                            id="previousPage">
                      <f:param name="firstResult"
                              value="#{dgnFinalDeliveryList.previousFirstResult}"/>
                  </s:link>

                  <s:link view="/DgnFinalDeliveryList.xhtml"
                      rendered="#{dgnFinalDeliveryList.nextExists}"
                         value="Next Page #{messages.right}"
                            id="nextPage">
                      <f:param name="firstResult"
                              value="#{dgnFinalDeliveryList.nextFirstResult}"/>
                  </s:link>

                  <s:link view="/DgnFinalDeliveryList.xhtml"
                      rendered="#{dgnFinalDeliveryList.nextExists}"
                         value="Last Page #{messages.right}#{messages.right}"
                            id="lastPage">
                      <f:param name="firstResult"
                              value="#{dgnFinalDeliveryList.lastFirstResult}"/>
                  </s:link>

              </div>

          <f:subview> 
                   <rich:modalPanel id="fileupload" width="850" height="400">
                 <f:facet name="header">
                      <h:panelGroup>
                          <h:outputText value="Upload Details"></h:outputText>
                      </h:panelGroup>
                  </f:facet>
                 
                  <f:facet name="controls">
                      <h:panelGroup>
                             <h:graphicImage value="../img/cancel.png"  id="cancel" />
                                              <rich:componentControl for="fileupload" attachTo="cancel" operation="hide" event="onclick"/>
                                   </h:panelGroup>
                  </f:facet>
                 <ui:include src="/request/FinalDeliveryUploadEdit.xhtml" >
                </ui:include> 
           
          </rich:modalPanel>
          </f:subview>
          </ui:define>
          </ui:composition>
          </blockquote>

          regards
          jack
          • 2. Re: How to the select datatable row value in ModalPanel
            Lavanya k Newbie

            I have a similar issue with my dataTable. This datatable has a commandlink that invokes 'remove' modalPanel to delete the row for which the commandLink is clicked. In this modalPanel, when I click the 'Yes' button, the corresponding row values are removed from the local collection object that is bind with dataTable and from the database also.


            There is a separate link below the dataTable that invokes 'add' modalPanelThe to insert new row in the dataTable. I am able to successfully add new row in the dataTable but not in the correct order. Thus when I tries to remove the record immediately after adding the record, the 'remove' modalPanel does not picks up the correct record. However when I refresh the page manually, the dataTable orders the rows correctly in the dataTable and then I am able to select and remove the correct record.


            Please let me know how to reRender the dataTable after the server side insert action is completed or suggest me an alternate solution for this issue.


            Thanks

            • 3. Re: How to the select datatable row value in ModalPanel
              Palani swamy Newbie
              Hi lavanya

              I solve this issue

              Just you see this link  _http://java.dzone.com/articles/an-introduction-to-jboss-richf?page=0,4_