0

我有一个显示在数据表中的产品列表,并且想要在弹出窗口中编辑数据表中的特定行,如下所述

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

我正在为此而苦苦挣扎,但我无法保存已编辑产品中的更改。打开弹出窗口时,我可以看到所选项目的属性,但是当我更改属性时,没有任何变化。这是我的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>
4

1 回答 1

1

请参阅 RichFaces 组件参考中的Placement标注:

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

The <rich:popupPanel> component is usually rendered in front of any other objects on the page. This is achieved by attaching the component to the <body> element of the page, and setting a very high "z-index" (the stack order of the object). This approach is taken because relatively-positioned elements could still overlap the pop-up panel if they exist at higher levels of the DOM hierarchy, even if their z-index is less than the <rich:popupPanel> component.

If the <rich:popupPanel> is to participate in submitting child components/behaviors, then a form element must be nested within the <rich:popupPanel>. Alternatively, if no overlapping elements exist, the <rich:popupPanel> component can be reattached to its original DOM element by setting domElementAttachment to either parent or form.

于 2013-10-07T05:41:23.517 回答