我可以将哪些值传递给 f:ajax 标记的事件属性?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7886453/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What values can I pass to the event attribute of the f:ajax tag?
提问by sfrj
I am trying to find a list of all the possible values I can pass to the attribute eventof the f:ajaxtag.
我试图找到我可以传递给标签属性event的所有可能值的列表f:ajax。
I know that I can also pass function names from my .js files, but what I need just the ones that come with JSF.
我知道我也可以从我的 .js 文件中传递函数名,但我只需要 JSF 附带的那些。
I only know about click mouseover and keyup, but I am sure there are more. Just don't know where to find them.
我只知道 click mouseover 和 keyup,但我相信还有更多。只是不知道在哪里可以找到它们。
回答by BalusC
The eventattribute of <f:ajax>can hold at leastall supported DOM eventsof the HTML element which is been generated by the JSF component in question. An easy way to find them all out is to check all on*attribues of the JSF input component of interest in the JSF tag library documentationand then remove the "on" prefix. For example, the <h:inputText>componentwhich renders <input type="text">lists the following on*attributes (of which I've already removed the "on" prefix so that it ultimately becomes the DOM event type name):
的event属性至少<f:ajax>可以包含由相关 JSF 组件生成的 HTML 元素的所有支持的DOM 事件。找到它们的一种简单方法是检查JSF 标记库文档on*中感兴趣的 JSF 输入组件的所有属性,然后删除“on”前缀。例如,呈现的组件列出了以下属性(其中我已经删除了“on”前缀,以便它最终成为 DOM 事件类型名称):<h:inputText><input type="text">on*
blurchangeclickdblclickfocuskeydownkeypresskeyupmousedownmousemovemouseoutmouseovermouseupselect
blurchangeclickdblclickfocuskeydownkeypresskeyupmousedownmousemovemouseoutmouseovermouseupselect
Additionally, JSF has two more special event names for EditableValueHolderand ActionSourcecomponents, the realHTML DOM event being rendered depends on the component type:
此外,JSF 为EditableValueHolder和ActionSource组件还有两个特殊的事件名称,渲染的真正HTML DOM 事件取决于组件类型:
valueChange(will render aschangeon text/select inputs and asclickon radio/checkbox inputs)action(will render asclickon command links/buttons)
valueChange(将呈现为change文本/选择输入和单click选框/复选框输入)action(将click在命令链接/按钮上呈现)
The above two are the defaultevents for the components in question.
以上两个是相关组件的默认事件。
Some JSF component libraries have additional customized event names which are generally more specialized kinds of valueChangeor actionevents, such as PrimeFaces <p:ajax>which supports among others tabChange, itemSelect, itemUnselect, dateSelect, page, sort, filter, close, etc depending on the parent <p:xxx>component. You can find them all in the "Ajax Behavior Events" subsection of each component's chapter in PrimeFaces Users Guide.
一些JSF组件库有其他的自定义事件的名称一般都比较专业种valueChange或action事件,如PrimeFaces<p:ajax>这其中包括支持tabChange,itemSelect,itemUnselect,dateSelect,page,sort,filter,close,等这取决于母公司的<p:xxx>组件。您可以在PrimeFaces 用户指南中每个组件章节的“Ajax 行为事件”小节中找到它们。
回答by 1392023093user
I just input some value that I knew was invalid and here is the output:
我只是输入了一些我知道无效的值,这是输出:
'whatToInput' is not a supported event for HtmlPanelGrid. Please specify one of these supported event names: click, dblclick, keydown, keypress, keyup, mousedown, mousemove, mouseout, mouseover, mouseup.
“whatToInput”不是 HtmlPanelGrid 支持的事件。请指定以下支持的事件名称之一:click、dblclick、keydown、keypress、keyup、mousedown、mousemove、mouseout、mouseover、mouseup。
So values you can pass to eventare
所以你可以传递给事件的值是
- click
- dblclick
- keydown
- mousedown
- mousemove
- mouseover
- mouseup
- 点击
- 双击
- 按键
- 鼠标按下
- 鼠标移动
- 鼠标移到
- 鼠标向上

