如何在 RichFaces 中添加服务器端和客户端事件处理程序
因此,当在我的 suggestBox 中选择一个选项时,我需要关注 richfaces 标签。通常这不会成为问题,但我有以下代码:
<rich:suggestionbox fetchValue="#{cap.nom_comp}"
suggestionAction="#{gestionRankingBean.autocompleteMedicamento}"
var="cap"
for="statesinput" id="suggestion" tokens=","
onselect="lossFocus()">
<h:column>
<h:outputText value="#{cap.nom_comp}" />
</h:column>
<a4j:support event="onselect" ajaxSingle="true" reRender="target">
<f:setPropertyActionListener value="#{cap.id}"
target="#{gestionRankingBean.sugerencia}" />
</a4j:support>
</rich:suggestionbox>
我的问题是,如果我将 onselect 事件留在第 5 行,则 a4j:support 标记将无法工作。似乎我无法以这种方式使用相同的事件。
lossFocus() 是一个 javascript 函数,它只做我想要的事情(纯 jquery)。那么有什么办法可以做到这一点吗?我在想是否有某种方法可以用 jquery 捕获 suggestBox 的 onselect 事件,让我的生活更轻松。但我不知道如何-
So, i need to focus a richfaces tag when an option is selected in my suggestionBox. Normally this wouldnt be a problem but I have the following code:
<rich:suggestionbox fetchValue="#{cap.nom_comp}"
suggestionAction="#{gestionRankingBean.autocompleteMedicamento}"
var="cap"
for="statesinput" id="suggestion" tokens=","
onselect="lossFocus()">
<h:column>
<h:outputText value="#{cap.nom_comp}" />
</h:column>
<a4j:support event="onselect" ajaxSingle="true" reRender="target">
<f:setPropertyActionListener value="#{cap.id}"
target="#{gestionRankingBean.sugerencia}" />
</a4j:support>
</rich:suggestionbox>
My problem is the a4j:support tag is not going to work if i leave the onselect event on the line 5.It seems like i cannot use the same event in this way.
lossFocus() is a javascript function that just does what i want ( pure jquery). So any way to do this? I was thinking if there is some way to capture the onselect event of the suggestionBox with jquery an make my life easier. But i dont know how-
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在 a4j:support 上使用 oncomplete="lostFocus()"。您也可以尝试 onsubmit。
Try using oncomplete="lostFocus()" on a4j:support. You could also try onsubmit.