2013-10-10 47 views
0

在我的crud應用程序中,我想選擇一行然後在彈出窗口中顯示該行數據。導航到另一個頁面工作並顯示數據。當我嘗試在彈出窗口中顯示它時,不顯示任何值。我可能是錯的,但我認爲彈出窗口在方法prepareView完成之前打開。JSF crud彈出窗口在值提交前打開

代碼塊:

<h:column> 
          <f:facet name="header"> 
           <h:outputText value="&nbsp;"/> 
          </f:facet> 
          <h:commandLink id="myLink" value="Action" action="#{timeLoggingDetailController.prepareView}" rendered="#{item.timeLoggingId eq AdminTimeLogging.filteredId}" styleClass="auto-style5"> 
           <rich:componentControl target="popup" operation="show"/> 
          </h:commandLink> 
         </h:column> 
        </h:dataTable> 
       </h:panelGroup> 
      </h:form> 
      <rich:popupPanel id="popup" modal="false" autosized="true" resizeable="false" domElementAttachment="form"> 
       <f:facet name="header"> 
        <h:outputText value="Approval level" /> 
       </f:facet> 
       <f:facet name="controls"> 
        <h:outputLink value="#" onclick="#{rich:component('popup')}.hide(); 
          return false;"> 
         Close 
        </h:outputLink> 
       </f:facet> 
       <h:form id="submitForm"> 
        <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> 
        <br /> 
        <h:panelGrid class="auto-style4"> 
         <h:commandLink action="#{timeLoggingDetailController.update}" value="#{bundle.EditTimeLoggingDetailSaveLink}" onclick="#{rich:component('popup')}.hide();" styleClass="linkbutton"/> 
        </h:panelGrid> 
       </h:form> 
      </rich:popupPanel> 
     </ui:define> 
    </ui:composition> 

</html> 
+0

可能是你的popuppanel不更新 – BholaVishwakarma

+0

以及如何更新它呢? – user1794974

+0

在調用方法的託管bean中,放入以下代碼:FacesContext.getCurrentInstance()。getPartialViewContext()。getRenderIds()。add(「menuForm:addLeaveDialog」); – BholaVishwakarma

回答

1

您可能需要使用<a4j:commandLink>,它提供的動作完成時觸發事件oncomplete

這應該爲你工作:

<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> 
+0

會給這個去並提供反饋,謝謝 – user1794974

+0

測試但不工作,彈出窗口不顯示?使用確切代碼 – user1794974

+0

彈出窗口不起作用,但是當我刪除event =「complete」時,它彈出並顯示最後選中的行的值,但不是我點擊的新值,因此彈出窗口仍然在方法完成之前執行,它幾乎在那裏告訴我,那裏只是最後一個小的變化,它會起作用 – user1794974