本文介绍了如何将JavaScript侦听器添加到PrimeFaces Ajax事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过javascript方法监听pickList传输事件,

I want to listen pickList transfer event via javascript method,

监听器适用于java bean:

Listener works well with java bean:

<p:pickList value="#{pickListBean.cities}" var="city"
itemLabel="#{city}" itemValue="#{city}">
<p:ajax event="transfer" listener="#{pickListBean.handleTransfer}" />
</p:pickList>

但这不起作用:

listener="myJavaScriptMethod(event)"

有没有像上面那样的监听事件?

Are there any way listening events like above?

推荐答案

监听器是服务器端,在客户端你可以使用oncomplete,onsuccess,..(你的选择) :

listener is serverside, in client you can use oncomplete, onsuccess,..(your option):

 <p:ajax event="transfer" oncomplete="js_function()" />
    <p:ajax event="transfer" onstart="js_function()" />
    ...

这篇关于如何将JavaScript侦听器添加到PrimeFaces Ajax事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:19