而使用AJAX监听Primefaces对话框架不工作 [英] Primefaces dialog framework not working while using ajax listener

查看:244
本文介绍了而使用AJAX监听Primefaces对话框架不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图打开使用Primefaces对话框4对话框架,

I'm trying to open dialog using Primefaces 4 dialog framework,

public void openDialog(String viewName) {
  RequestContext.getCurrentInstance().openDialog(viewName);
}

本作品:

<p:commandButton value="Click" action="#{impaktDialogBean.openDialog('/popup/test2')}"/>

这不:

<p:commandButton value="Click">     
  <p:ajax event="click" listener="#{impaktDialogBean.openDialog('/popup/test2')}" ></p:ajax>
</p:commandButton>

所以,Primefaces对话框架只用行动和功放的工作原理; ActionListener的?????

So, Primefaces dialog framework only works with action & actionListener?????

我使用的是:

  • Primefaces 4
  • 在Tomcat 7的
  • 在JSF 2.2.6 Mojarra

感谢。

推荐答案

我已经找到了最简单的解决方法是火了通过JavaScript的按钮。

The easiest solution I've found is to fire up the button via javascript.

在打开的对话​​框(可能隐藏)按钮:

The button that opens the dialog (maybe hidden):

<p:commandButton id="myButton" action="#{bean.openMyDialog}" style="display:none" />

阿贾克斯事件点击按钮:

The ajax event that 'clicks' the button:

<p:ajax ... oncomplete=" $('#myButton').click() " />

这篇关于而使用AJAX监听Primefaces对话框架不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆