在使用ajax侦听器时,“原型”对话框框架不起作用 [英] Primefaces dialog framework not working while using ajax listener

查看:191
本文介绍了在使用ajax侦听器时,“原型”对话框框架不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Primefaces 4对话框框架打开对话框,

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

这样做:

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

这不是:

 < p:commandButton value =点击> 
< p:ajax event =clicklistener =#{impaktDialogBean.openDialog('/ popup / test2')}>< / p:ajax>
< / p:commandButton>

所以,Primefaces对话框框架只适用于action& actionListener



我使用的是:





  • Tomcat 7

  • JSF 2.2.6 Mojarra



<

解决方案

我知道问题很久以前,但未来的时间...



一个< p:remoteCommand>

 < p:remoteCommand name =remoteCmdupdate =anythingactionListener =#{impaktDialogBean.openDialog('/ popup / test2')}/> 

< p:commandButton value =点击update =任何东西onclick =remoteCmd()>

实现对您的bean的JavaScript调用的不同方法。


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

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

This works:

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

This doesn't:

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

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

I'm using:

  • Primefaces 4
  • Tomcat 7
  • JSF 2.2.6 Mojarra

Thanks.

解决方案

I know the question was asked long time ago but for future times...

What about a <p:remoteCommand> ?

<p:remoteCommand name="remoteCmd" update="anything" actionListener="#{impaktDialogBean.openDialog('/popup/test2')}" />

<p:commandButton value="Click" update="anything" onclick="remoteCmd()" >

Different approach to achieve a javascript call to your bean.

这篇关于在使用ajax侦听器时,“原型”对话框框架不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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