隐藏 a4j:outputPanel 并在提交 a4j 命令按钮上显示它
从现在开始,我有这个:
.....
<a4j:commandButton action="#{ChoixContratBean.Submit1}" reRender="suite" value="valider" > </a4j:commandButton>
</a4j:outputPanel>
<a4j:outputPanel display="none" id="suite">
<jsf:outputText id="reponseeFormule"............
有效。套件面板已重新渲染。但我想隐藏这个名为 suite 的输出面板。并在用户通过命令按钮验证后显示它...我不知道如何做到这一点,有人有想法吗?
谢谢 !
From now on, I have this :
.....
<a4j:commandButton action="#{ChoixContratBean.Submit1}" reRender="suite" value="valider" > </a4j:commandButton>
</a4j:outputPanel>
<a4j:outputPanel display="none" id="suite">
<jsf:outputText id="reponseeFormule"............
which works. the suite panel is rerendered. But I would like to hide this outputpanel named suite. and show it once the user validated via the commandButton... I can't find out how to do it, anyone has an idea ?
thank you !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我终于在几个小时后发现了。 (我在搜索了几个小时后发布了这个问题,我是richfaces的初学者)
这不是很复杂,但是有一个你不想掉入的小陷阱。最终的代码如下所示:
首先必须渲染一个outputPanel= true 或 ajax 不会触及它。这是我的第一个错误,我想我可以制作一个outputPanel render="#{ChoixContrat.someBool},并在链接到命令按钮的ajax操作中更改它。但是不,如果它首先设置rendered = false,ajax将不会'无法将其更改为 true,因为它首先是不可访问的!您必须在包含您想要隐藏的内容并且位于 outputPanel id= 套件中的组件中设置 render=some 布尔值!对于我的示例,outputPanel 始终会呈现,但无论您的容器呈现的属性在后面的 ajax 方法中设置为 false 还是 true,其中的组件都将保持隐藏或可见状态。
希望我很清楚,因为我是法国人......
Ok I finally found out after hours. (I posted the question after hours of search, I'm a beginner in richfaces)
It's not very complicated but there's a little trap you don't want to fall in. The final code looks like that :
First an outputPanel must be rendered= true or ajax won't touch it. That was my first mistake, I thought I could make an outputPanel rendered="#{ChoixContrat.someBool}, and change it in the ajax action linked to the command button. But no, if it's first set rendered = false, ajax won't be able to change it to true, because it's not reachable in the first place! You got to set rendered=some boolean in your back bean in a component wich contains what you want to hide and which is in the outputPanel id= suite as for my example. This way, the outputPanel is always rendered, but the component in it will remain hidden or visible whether your contrainer's attribute rendered is set to false or true in the back, in the ajax method..
hope I'm clear coz I'm french.....