[Solved] 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

Enquirer: sp00m

||

Solution #1:

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.

Respondent: skuntsel

Solution #2:

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.

Respondent: Makhiel

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.