2010-11-19 33 views
1

我显示一个<rich:modalPanel>不止一次的问题。 我有一个表格,它有一个<a4j:commandlink onclick="#{rich:component('mp')}.show()" (也试过​​)。rich:modalpanel将不会显示超过从窗体调用

此方法正常工作一次。在模态面板中,我有一个新的表单,并在提交按钮(a4j:commandButton)上附加了一些操作。当这个动作完成时,使用与上面相同的方法隐藏模式面板,使用oncomplete="#{rich:component('mp')}.hide()",并且包含命令链接的表单被重新编辑。

现在,问题是用于显示模态面板的commandLink不再起作用。如果我在onclick事件中输入了js alert('something'),我可以认为onclick事件被触发,但是没有呈现modalpanel。

希望这是足够的信息......我可以根据需要

感谢

后来添加一些源代码

编辑: 这里的一些代码:

<a4j:form prependId="false" ajaxSubmit="true"> 
    <a4j:outputPanel id="createActivityPanel"> 
     <h:panelGrid columns ="2"> 
      <h:outputLabel value="#{msg.createActivityExpectedParticipantsLabel}" /> 
      <h:panelGrid columns ="2"> 
       <h:outputLabel value="#{msg.createActivityAvailablePointsLabel}: #{sessionBean.loggedInUser.letspoints}" /> 
       <a4j:commandLink value="#{msg.createActivityGetMorePointsLinkLabel}" onclick="#{rich:component('convertPointsPanel')}.show()" /> 
       <rich:inputNumberSlider id="participantsSlider" value="#{activityRequestBean.newActivityExpectedNoParticipants}" maxValue="#{activityRequestBean.maxNoParticipants}" /> 
      </h:panelGrid> 
     </h:panelGrid> 
    </a4j:outputPanel> 
</a4j:form> 
<rich:modalPanel rendered="#{sessionBean.loggedIn}" id="convertPointsPanel" width="700" height="400"> 
    <a4j:support event="onhide" reRender="createActivityPanel"></a4j:support> 
    <f:facet name="header"> 
     <h:outputText value="Velg poeng fra kategorier for å konvertere" /> 
    </f:facet> 
    <f:facet name="controls"> 
     <a4j:form><a4j:commandButton id="closeButton" onclick="#{rich:component('convertPointsPanel')}.hide()" type="image" image="/img/close.gif"/></a4j:form> 
    </f:facet> 
    <a4j:form prependId="false" ajaxSubmit="true" id="convertPointsForm"> 
     <h:panelGrid columns ="2"> 
      <h:panelGroup layout="block" style="width:350px; float:left;"> 
       <rich:dataList var="catscore" value="#{pointsRequestBean.scores}" id="activityPointSliderList"> 
        <h:graphicImage height="30" width="30" value="#{catscore.usercategoryscore.category.imagepath}" /> 
        <h:outputText value="#{catscore.usercategoryscore.category.name}" /> 
        <rich:inputNumberSlider maxValue="#{catscore.usercategoryscore.score}" value="#{catscore.transferredScore}" step="2" /> 
       </rich:dataList> 
       <a4j:commandButton value="Konverter" id="convertButton" action="#{pointsRequestBean.convertPoints}" oncomplete="#{rich:component('convertPointsPanel')}.hide()" reRender="createActivityPanel"/> 
      </h:panelGroup> 
      <h:panelGroup layout="block" style="width:350px; float:right; border-left: 1px solid #ACBECE; padding: 10px;"> 
       <h:outputText value="kjøp poeng fra paypal?" /> 
      </h:panelGroup> 
     </h:panelGrid> 
    </a4j:form> 
</rich:modalPanel> 

注意到我遵循重新提交面板而不是表格的建议。

回答

2

您可以发布XHTML代码吗?

基本上,您的问题之一可能是由于您reRender表单的事实。一般来说,这不是一个好主意。一种解决方案是包含一个<a4j:outputPanel>,然后重新呈现此面板而不是表单本身。

其所以不是:

<a4j:commandButton ... reRender="myForm"/> 
<h:form id="myForm"> 
    ... 
</h:form> 

你可以这样做:

<a4j:commandButton ... reRender="myFormContent"/> 
<h:form id="myForm"> 
    <a4j:outputPanel id="myFormContent"> 
     ... 
    </a4j:outputPanel> 
</h:form> 

如果这不起作用,请在您的问题添加更多的代码。

+0

你解决了我的问题! Tkz !! – velteyn 2014-03-07 11:47:49