0

想做的事情是:在我的数据表上,最后一列有视图,编辑和删除。View 有以下方法来获取行数据:

public String prepareView() {
    current = (TimeLoggingDetail) getItems().getRowData();
    selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
    return "View";
}

单击视图时,它会将我重定向到可以查看所选值的页面。我想将其更改为在弹出窗口中显示值,而不是重定向到显示它的页面。

所以我尝试了以下方法:

<a4j:commandLink id="myLink" value="Action" actionListener="#{timeLoggingDetailController.prepareView}" rendered="#{item.timeLoggingId eq AdminTimeLogging.filteredId}" styleClass="auto-style5">
    <rich:componentControl event="complete" target="popup" operation="show"/>
</a4j:commandLink>

如果我单击按钮,弹出窗口不会显示,当我删除event="complete"弹出窗口时会显示但没有值。如果我完全删除弹出代码,请单击查看,然后再次添加弹出代码,它会显示但只有我选择的旧值没有弹出代码,即内存中的值。

我也试过:

<a4j:commandLink id="myBut" action="#{timeLoggingDetailController.prepareView}" execute="@this" value="Test" styleClass="auto-style5" render="popup" oncomplete="#{rich:component('popup')}.show()">
                            </a4j:commandLink>

它也不会打开弹出窗口,我尝试#{rich:component('popup')}.show()过多种方式使用但它没有打开,我应该更改方法prepareView以返回特定的东西吗?我应该做一个条件来显示带有这些值的弹出窗口吗?似乎弹出窗口在方法完成之前打开。在<a4j:commandLink/>代码中:

<h:column>
   <f:facet name="header">
      <h:outputText value="&nbsp;"/>
   </f:facet>
   <a4j:commandLink id="myBut" action="#{timeLoggingDetailController.prepareView}" execute="@this" value="Test" styleClass="auto-style5" render="popup" oncomplete="#{rich:component('popup')}.show()">
   </a4j:commandLink>
<h:column/> 

我的弹出面板:

<h:column>
                        <f:facet name="header">
                            <h:outputText value="&nbsp;"/>
                        </f:facet>
                        <a4j:commandLink id="myBut" action="#{timeLoggingDetailController.prepareView}" execute="@this" value="Test" styleClass="auto-style5" render="popup" oncomplete="#{rich:component('popup')}.show()">
                        </a4j:commandLink>
                        <rich:popupPanel id="popup" modal="true" autosized="true" resizeable="false" domElementAttachment="form">
                            <f:facet name="header">
                                <h:outputText value="TEST" />
                            </f:facet>
                            <f:facet name="controls">
                                <h:outputLink value="#" onclick="#{rich:component('popup')}.hide();
                                        return false;">
                                    Close
                                </h:outputLink>
                            </f:facet>
                            <h:panelGrid columns="2">
                                <h:outputText value="#{bundle.ViewTimeLoggingDetailLabel_date}"/>
                                <h:outputText value="#{timeLoggingDetailController.selected.date}" title="#{bundle.ViewTimeLoggingDetailTitle_date}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>
                                <h:outputText value="#{bundle.ViewTimeLoggingDetailLabel_description}"/>
                                <h:outputText value="#{timeLoggingDetailController.selected.description}" title="#{bundle.ViewTimeLoggingDetailTitle_description}"/>
                                <h:outputText value="#{bundle.ViewTimeLoggingDetailLabel_normalHours}"/>
                                <h:outputText value="#{timeLoggingDetailController.selected.normalHours}" title="#{bundle.ViewTimeLoggingDetailTitle_normalHours}"/>
                                <h:outputText value="#{bundle.ViewTimeLoggingDetailLabel_overtimeHours}"/>
                                <h:outputText value="#{timeLoggingDetailController.selected.overtimeHours}" title="#{bundle.ViewTimeLoggingDetailTitle_overtimeHours}"/>
                                <h:outputText value="#{bundle.ViewTimeLoggingDetailLabel_doubleTimeHours}"/>
                                <h:outputText value="#{timeLoggingDetailController.selected.doubleTimeHours}" title="#{bundle.ViewTimeLoggingDetailTitle_doubleTimeHours}"/>
                                <h:outputText value="#{bundle.ViewTimeLoggingDetailLabel_approvalLevelsId}"/>
                                <h:outputText value="#{timeLoggingDetailController.selected.approvalLevelsId}" title="#{bundle.ViewTimeLoggingDetailTitle_approvalLevelsId}"/>
                            </h:panelGrid>value="#{approvalLevelsController.selected.description}" title="#{bundle.ViewApprovalLevelsTitle_description}"/>

                            <br />
                            <h:panelGrid  class="auto-style4">
                                <h:commandLink   action="#{timeLoggingDetailController.update}" value="#{bundle.EditTimeLoggingDetailSaveLink}" onclick="#{rich:component('popup')}.hide();" styleClass="linkbutton"/>
                            </h:panelGrid>
                        </rich:popupPanel>
                    </h:column> 
4

0 回答 0