3 Replies Latest reply on Aug 29, 2007 8:40 AM by m.shinde

    Uisng h:dataTable as part of a form

    wiberto

      Hi,

      I'm trying to update the members of a list, so I'm trying to use the h:dataTable to display the list and allow me to edit the fields of the elements.

      So I have something like this:

      <h:dataTable styleClass="cooltable" value="#{product.productLimits}" var="currentLimit">
      <h:column>
       <f:facet name="header">Name</f:facet>
       <h:inputText id="endDate" value="#{currentLimit.limitName}" tabindex="1" class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"/>
      </h:column>
      <h:column>
       <f:facet name="header">Display Label</f:facet>
       <h:inputText id="endDate" value="#{currentLimit.limitDisplayLabel}" tabindex="1" class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"/>
      
      </h:column>
      
      </h:dataTable>
      


      This is just a piece of the form since I edit other product fileds also.

      When I don't have the dataTable piece in the page the edit action of the form is called. As soon as I add the datatable nothing happens. I don't see an exception, but the same page is rendered but the updates were not persisted since the action was not called.

      Is what I'm trying to do allowed? How do oyu guys update the members of a list? I could use the DataModel and the click on the table to edit, but I would like to avoid having to go down another level. Would be nice to do it all in the same page.

      Here's the top of the form just in case it helps:

      <tr>
       <td class="big"><strong>Product Information</strong></td>
       <td align="right" >
       <h:commandButton type="submit" value="Save" action="#{productmanager.editProduct(product)}"/>
       <h:commandButton value="Cancel" action="#{productmanager.noUpdates(product)}"/>
       </td>
       </tr>
       </table>
      
       <table border="0" cellpadding="5" cellspacing="0" width="500">
       <tr style="height:30px" >
       <td align="right" width="35%" class="dvtCellLabel">Product ID</td>
       <td align="left" width="65%" class="dvtCellInfo">#{product.productId}</td>
       </tr>
       <tr style="height:30px" >
       <td align="right" width="35%" class="dvtCellLabel">Product Name</td>
       <td align="left" width="65%" class="dvtCellInfo">
       <h:inputText value="#{product.productName}" class="detailedViewTextBox" onFocus="this.class='detailedViewTextBoxOn'" onBlur="this.class='detailedViewTextBox'"/>
       </td>
       </tr>
      


      Thanks,

      Jose