简体   繁体   中英

Exhaustive list of available events for a4j:ajax?

Where can I get the exhaustive list of available events for <a4j:ajax event="..." /> ?

RichFaces's doc says "name of JavaScript event property (click, change, etc.)" , but I'm precisely looking for this "etc." ;)

Side note: I'm note sure it refers exactly to the JavaScript events names since AFAIK, you have to use selectitem rather than select ...

To recite RichFaces component reference on the subject (emphasis mine):

The <a4j:ajax> behavior allows Ajax capability to be added to a non-Ajax component. The non-Ajax component must implement the ClientBehaviorHolder interface for all the event attributes that support behavior rendering .

To proceed one step further one should look into ClientBehaviorHolder interface, especially the ClientBehaviorHolder#getEventNames() method that

Returns a non-null, unmodifiable Collection containing the names of the logical events supported by the component implementing this interface

This way it would not be too tough to find out the list of events the component can fire.

Basically, as you suspected, all basic JavaScript events are supported and a set of custom ones that are (typically) mentioned in component's documentation (those with on prefix), but with prefix omitted (like onlistshow would turn into event="listshow" ).

Also, it is worth mentioning that there are two additional 'standard' event types in JSF that will render the necessary/right HTML DOM event, depending on the component in question. Those are action for components that implement ActionSource interface and valueChange for components that implement EditableValueHolder .

The list of available events depends on what component you're working with. All the Mouse, Keyboard and Form events should be supported (not sure about the onerror and such) and if you're working with, say, <rich:select> you get access to custom events like listclick , listdblclick , selectitem etc. which are described in the docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM