Hide/Show behavior

Provides specialized hide/show tag support for use by the hx:panelActionbar component.

This behavior is not intended for general use outside of the implementation of the panelActionbar component. To hide/show a field, use the JSFBehaviorGeneric with the hide, show and inverthide actions.

Hides/Shows a "node" (subpanel) in a hx:panelActionbar. When the node is shown/hidden, child nodes within it can be "closed" (hidden) optionally be hidden (that is, "auto-collapsed").

The state of the node (visible/hidden) is maintained in a hidden field on the page which can be submitted back to the server. This allows the "state" of open/closed nodes to be maintained when the page is redisplayed.

JSF tags that emit the component

<hx:panelActionbar>

Base HTML

None. Use is private to the implementation of the <hx:panelActionbar>.

JavaScriptâ„¢ constructor

hX_5.addBehavior("id", "onclick", new hX_5.JSFBehaviorHS(attributes)); where

id

The ID of the HTML tag to which the component is attached.

attributes

Comma separated list of attributes where each attribute is a quoted string consisting of the attribute name and value separated by a colon, for example "label:MyLabel".

Supported events

Event

Description

onclick

Use is private to the implementation of the <hx:panelActionbar>

Attributes

Table 1. Hide/Show behavior attributes

Attribute name

Description

hide-object

Hide/Show this tag.

hide-tree

If present, should be same as hide-object. Collapses all children that are tables within hide-object.

hide-field

Identifier of a hidden field on the page where the current state of the hide-object is maintained. Submitted back to the server on a submit. Values returned are either "none" or "display".

hide-field-value

The initial value of hide-field. The hide-object is initially hidden/shown based on this value. Hide-field's value is initialized with this as well.

Sequencing

Runs after any other handlers provided for the event.

Does not stop the event continuing/bubbling.

API calls

Table 2. Hide/Show behavior API calls

API call

Description

object = setAttribute(attribute)

Sets an attribute or changes its value (if it was set previously).

string = getAttribute(attribute-name)

Retrieves the current value of an attribute.

Limitations

Prior to JWL 2.1, if a node in the tree contained a JSF component, the component may not have drawn correctly when the node was displayed. This has been fixed.

Example code

For a hx:panelActionbar with three sub-panels, set up each sub-panel so it can be hidden/shown when clicked:

hX.addBehavior("actionbar2_link", "onclick",new hX.JSFBehaviorHS ("hide-object:actionbar2_table", 
                 "hide-tree:actionbar2_table","hide-field:actionbar2_display", "hide-field-value:display"));
hX.addBehavior("actionbar5_link", "onclick",new hX.JSFBehaviorHS ("hide-object:actionbar5_table", 
                 "hide-tree:actionbar5_table","hide-field:actionbar5_display", "hide-field-value:none"));
hX.addBehavior("actionbar3_link", "onclick",new hX.JSFBehaviorHS ("hide-object:actionbar3_table", 
                 "hide-tree:actionbar3_table","hide-field:actionbar3_display", "hide-field-value:none"));

Feedback