Richfaces 组件控制切换弹出窗口
我希望单个控件显示 rich:popupPanel (如果它不可见),并隐藏它(如果它已经可见)。
通过教程和代码示例,我想出了:
<h:outputLink value="#" id="loginLink">Login
<rich:componentControl event="click" operation="show" target="loginPane" >
<a4j:param name="event" value="event" noEscape="true" />
... more params for positioning ...
</rich:componentControl>
</h:outputLink>
<rich:popupPanel id="loginPane" autosized="true" modal="false" moveable="false" resizeable="false" followByScroll="false" onshow="#{rich:element('userName')}.focus()" >
<h:form>
...
</h:form>
</rich:popupPanel>
它很好地显示了我的 popupPanel 和后续表单。我只是无法识别一种方法来重载该outputLink的componentControl以隐藏和显示。当然,“toggle”不是一个关键字 - 那太简单了:) 我对 JSF 和 javascript 还很陌生,并且在今天的大部分时间里一直在尝试各种事情。谁能推荐一些东西让我朝着正确的方向前进?
I'd like for a single control to show a rich:popupPanel if it isn't visible, and hide it if it's already visible.
Following through the tutorials and code examples, I've come up with:
<h:outputLink value="#" id="loginLink">Login
<rich:componentControl event="click" operation="show" target="loginPane" >
<a4j:param name="event" value="event" noEscape="true" />
... more params for positioning ...
</rich:componentControl>
</h:outputLink>
<rich:popupPanel id="loginPane" autosized="true" modal="false" moveable="false" resizeable="false" followByScroll="false" onshow="#{rich:element('userName')}.focus()" >
<h:form>
...
</h:form>
</rich:popupPanel>
Which shows my popupPanel and subsequent form well. I just can't recognize a way to overload that outputLink's componentControl to hide as well as show. Naturally "toggle" isn't a keyword - that would be too easy :) I'm pretty new with JSF and javascript, and have been trying various things for the better part of today. Can anyone recommend something to get me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对我来说,以下解决方案有效,而confirmPanel是弹出窗口中包含更新数据的面板。
For me the following solution worked, while confirmPanel is the panel in the popup containing the updated data.
最后,我最终选择了懒惰的路线:
我内联编辑了页面的 css,以采用 rf-p-shade 样式而不影响 alpha,并创建了一个 onmaskclick 事件来关闭弹出窗口。我无法让它用 javascript 或 jsf 符号复制“切换”之类的行为。
In the end, I ended up just choosing the lazy route:
I edited the css of the page inline to take the rf-p-shade style not effect alpha and made an onmaskclick event to close the popup. I could not get it to replicate a "Toggle" like behavior with javascript or jsf notations.
我刚刚偶然发现了这一点。希望经过这么长时间,有人会发现我相对简单的解决方案很有用:
请注意:它仅适用于非模式面板。
您甚至可以有多个弹出窗口,并且在一个弹出窗口的 onshow() 上,您可以关闭所有其他弹出窗口。当然,每个人都需要一个单独的 ...Visible 变量。
I've just stumbled on this. Hopefully, someone will find my relatively simple solution useful after such a long time:
Please note: it only works with a non-modal panel.
You can even have multiple popups, and on onshow() of one popup, you can close all the others. Of course, you need a separate ...Visible variable for each of them.