0 Replies Latest reply on Nov 19, 2007 6:30 PM by Arbi Sookazian

    submitting a dataTable/DataModel via modalPanel

    Arbi Sookazian Master

      using Seam 2.0.0.GA. I have posted this on the Seam forum but was wondering how Richfaces users would handle this as well...

      is it possible to do this? I'm basically trying to submit a dataTable/form in a xhtml from a a4j:form in modalPanel.

      I relocated the submit button from each row of the @DataModel @Factory driven h:dataTable in my xhtml to the a4j:form in a rich:modalPanel.

      Now I'm realizing that the way it was working before was the submit buttons were posting the user inputted data from the xhtml to the SFSB.

      My main question is: in order for the "latest" user entered data to be available in the backing SFSB when user submits, must you have the submit button embedded in the dataTable form or can you somehow achieve propagation and subsequent persistence from a4j:form in modalPanel?

      Use case is basically having the submit/cancel buttons display in modalPanel after user clicks on all 3 radio buttons in a particular row.

      I'm not sure how to pass the currentRow param to the submit method on the SFSB b/c the value of myAuditList.getRowIndex() = -1 in the submit method in SFSB. So I was looking into Seam remoting to set the currentRowNum of the dataTable in the SFSB instance variable. Not only that, I'm not sure how to "inject" the latest data from dataTable into submit method via modalPanel submission. It seems that is part of the Seam magic. The @DataModelSelection annotation tells Seam to inject the List element that corresponded to the clicked link (pg. 14 - 2.0GA ref pdf).

      <h:dataTable id="dataTable1" value="#{myAuditList}"

      <rich:modalPanel id="mpEmployeeSubmit" minHeight="200" minWidth="450"
       height="500" width="500" zindex="2000">
       <f:facet name="header">
       <a4j:form id="a4jHeaderForm2">
       <h:outputText id="headerText2" value=""/>
       <a4j:form id="a4jMainForm2">
       <h:panelGrid columns="2" style="vertical-align:middle">
       <h:outputText id="description2" value=""/>
       <!-- hidden variables are null/empty in NoteAction submit method, using Seam remoting -->
       <h:inputHidden id="rowIndex2" value="noteAction.rowIndex"/>
       <h:inputHidden id="colName2" value="noteAction.colName"/>
       <a4j:commandButton value="submit" action="#{securityAuditAction.submit}" onclick="Richfaces.hideModalPanel('mpEmployeeSubmit')"/>
       <a4j:commandButton value="cancel" onclick="Richfaces.hideModalPanel('mpEmployeeSubmit');unselectCurrentRadioButton()"/>

      Perhaps you must have hidden submit buttons per row in addition to the modalPanel submit buttons and when the user clicks the submit button on the modalPanel, an onclick event handler "clicks" the submit button for the appropriate row in the dataTable form.

      would that work or is there a better way? thx.