停止JSF事件链 [英] Stop JSF Event Chain

查看:71
本文介绍了停止JSF事件链的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在修改用于平板电脑的jsf-1.2应用程序.

I'm working on modifying a jsf-1.2 application for use on a tablet pc.

为此,我使表中的行可单击以打开行内容的详细信息视图,而不是让用户单击该表中的链接(在台式机版本中就是这种情况).

For that purpose I have made the rows of a table clickable to open the detail view of the rows contents, rather than have the user click on a link in that table (which is the case in the Desktop Version).

到目前为止效果很好.但是,每一行都可以包含两个丰富的按钮,用于打开不同的链接.

It works fine so far. Each row can, however, contain two rich-buttons that open a different link.

该链接的内容在一个新标签页中打开,如预期的那样.我的问题是,rowclick的动作事件也在原始选项卡中被激活,这不是预期的行为.

The contents of that link is opened in a new tab, like it's supposed to. My problem is, that the action event of the rowclick is activated in the original tab as well, which is not the intended behaviour.

我现在想做的是,如果单击该行中的按钮之一,则停止事件.

What I want to do now is stop the event if one of the buttons in the row is clicked.

我已经知道,按钮的事件是在rowclick事件之前触发的.现在有没有办法切断事件链?

I know already, that the event of the butons is fired before the rowclick event. Is there a way to just cut the event chain at this point?

推荐答案

这是由于事件冒泡而发生的.尝试如下在 commandButton 中使用 Event.stop(event); .

This happens due to Event Bubbling. Try using Event.stop(event); in your commandButton as below.

<a4j:commandButton onclick="Event.stop(event);" action="#{myBean.myMethod())}" value="Show" />

这篇关于停止JSF事件链的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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