2013-10-04 41 views
0

我具有其上显示在数据表中的产品的列表,并希望下面的dataTable-popupPanel主详细不保存编辑的值

一个DataTable如所描述的在一个弹出到编辑从数据表中的特定行与所有员工的详细信息一样,每一行都有编辑按钮。单击编辑按钮时,新弹出窗口应显示特定点击产品的现有信息,编辑后必须反映该列表中特定对象的更改以及在数据表中。

我很努力,但我无法保存编辑过的产品中的更改。当弹出窗口打开时,l可以看到所选的项目属性,但当我更改属性时,没有任何更改。 这里是我的jsf代码。

<a4j:outputPanel ajaxRendered="true"> 
    <h:dataTable id="table1" value="#{productBean.products}" var="item" 
     styleClass="resultTable" headerClass="resultTableHeader" 
     rowClasses="resultTableRow"> 
     <h:column> 
      <f:facet name="header"> 
       <h:outputText value="Part#" /> 
      </f:facet> 
      <h:outputText value="#{item.partNumber}" /> 
     </h:column> 

     <h:column> 
      <f:facet name="header"> 
       <h:outputText value="Product Description" /> 
      </f:facet> 
      <h:outputText value="#{item.description}" /> 
     </h:column> 
     <h:column> 
     <a4j:commandButton value="Edit" action="#{productBean.setEditItem(item)}" oncomplete="#{rich:component('popup')}.show()"> </a4j:commandButton> 

        <rich:popupPanel id="popup" modal="true" resizeable="true" 
       onmaskclick="#{rich:component('popup')}.hide()"> 
       <f:facet name="header"> 
        <h:outputText value="Edit property of the product" /> 
       </f:facet> 
       <f:facet name="controls"> 
        <h:outputLink value="#" 
         onclick="#{rich:component('popup')}.hide(); return false;"> 
         X 
        </h:outputLink> 
       </f:facet> 
       <!-- editProduct ı burda item yerine kullan -->      
       <table style="align: center;"> 
        <tr> 
         <td><h:panelGrid columns="2"> 
           <h:outputText value="Description"></h:outputText> 
           <h:inputText value="#{productBean.item.description}"></h:inputText> 
          </h:panelGrid></td> 
        </tr> 
        <tr> 
         <td><h:panelGrid columns="2"> 
           <h:outputText value="Part Number"></h:outputText> 
           <h:inputText value="#{item.partNumber}"></h:inputText> 
          </h:panelGrid></td> 
        </tr> 
       </table> 
        <a4j:commandButton value="Submit" action="#{productBean.actionEditProductsFromDatabase(item)}" execute="@popup"/> 
        <a4j:commandButton value="Cancel" onclick="#{rich:component('editPane')}.hide(); return false;" /> 
      </rich:popupPanel> 
     </h:column> 
    </h:dataTable> 

</a4j:outputPanel> 

</h:form> 

回答

1

参考放置标注在RichFaces的组件参考:

http://docs.jboss.org/richfaces/latest_4_X/Component_Reference/en-US/html_single/#sect-Component_Reference-Panels-richpopupPanel

<rich:popupPanel>组分在在任何 其它对象的前面通常呈现页。这通过将组件 附加到页面的<body>元素并设置非常高的“z-索引” (对象的堆栈顺序)来实现。因为 相对位置的元素仍然可以与弹出式面板重叠(如果 它们存在于DOM层次结构的较高级别,即使它们的 z-index小于<rich:popupPanel>组件也会采用此方法。

如果<rich:popupPanel>是参与提交儿 组件/行为,那么表单元素必须嵌套内 <rich:popupPanel>。或者,如果不存在重叠元素,则 <rich:popupPanel>组件可以通过重新附加到其原始DOM 元素,将domElementAttachment设置为父代或