0

从现在开始,我有这个:

.....
<a4j:commandButton  action="#{ChoixContratBean.Submit1}" reRender="suite" value="valider"  > </a4j:commandButton>
        </a4j:outputPanel>

    <a4j:outputPanel display="none" id="suite">
    <jsf:outputText id="reponseeFormule"............

哪个有效。套件面板被重新渲染。但我想隐藏这个名为套件的输出面板。并在用户通过命令按钮验证后显示它...我不知道该怎么做,有人有想法吗?

谢谢你 !

4

1 回答 1

1

好吧,我终于在几个小时后发现了。(经过数小时的搜索,我发布了这个问题,我是 Richfaces 的初学者)

这不是很复杂,但有一个你不想陷入的小陷阱。最终代码如下所示:

     ......<a4j:outputPanel id="check">
    <richfaces:panel rendered="#{ChoixContratBean.essaiValid}">
    <jsf:outputText value="#{ChoixContratBean.check}" /></richfaces:panel>
        </a4j:outputPanel>                  
    </td>               
   </tr>                
 </table>
</richfaces:simpleTogglePanel> 
    <a4j:commandButton  action="#{ChoixContratBean.Submit1}" reRender="suite, check" value="valider"> </a4j:commandButton>  
        <a4j:outputPanel id="suite" >
<richfaces:simpleTogglePanel rendered="#{ChoixContratBean.suite}" switchType="ajax"......

首先必须将 outputPanel 渲染为 true,否则 ajax 将不会触及它。那是我的第一个错误,我以为我可以制作一个 outputPanel 渲染 =“#{ChoixContrat.someBool},并在链接到命令按钮的 ajax 操作中更改它。但是不,如果它首先设置为 render = false,ajax 将不会”无法将其更改为 true,因为它一开始就无法访问!您必须在组件中的 back bean 中设置 render=some boolean,该组件包含您要隐藏的内容,并且在 outputPanel id= 套件中为举个例子。这样,outputPanel 总是被渲染,但是无论你的 contrainer 的属性在 ajax 方法中设置为 false 还是 true,它的组件都将保持隐藏或可见。

希望我很清楚因为我是法国人.....

于 2010-07-04T14:47:46.857 回答