Table of Contents Previous Section

WONestedList

Synopsis

WONestedList { list=anObjectList; item=anIteratedObject; value=displayedValue; sublist = aSubarray; action=aMethod; selection=selectedValue; [index=aCurrentIndex;] [level=aCurrentLevel;] [isOrdered=YES|NO;] [prefix=prefixString;] [suffix=suffixString;] ... };

Description

WONestedList recursively displays a hierarchical, ordered (numbered) or unordered (bulleted) list of hyperlinks. This element is useful when you want to display hierarchical lists. When the user clicks one of the objects in the list, it is returned in selection and the action method is invoked.

At any point during iteration of the list, the method specified by the sublist attribute returns the current list's sublist (if any), level specifies the current nesting level (where the topmost level is zero), index gives index of the current item within that nesting level (item returns the actual item), and isOrdered specifies whether the current sublist should be a numbered list or a bulleted list.

list
Hierarchical array of objects that the WONestedList will iterate through.
item
Current item in the list array. (This attribute's value is updated with each iteration.)
value
String to display as a hyperlink for the current item.
sublist
Method that returns the sublist of the current item or nil if the current item is a leaf.
action
Action method to invoke when the element is activated. This method must return a WOElement.
selection
When the page is submitted, selection contains the item that the user clicked.
index
Index of the current iteration of the WONestedList. The index is unique to each level-that is, it starts at 0 for each sublist.
level
Nesting level of the current iteration of the WONestedList. The topmost level is level 0.
isOrdered
If isOrdered evaluates to YES, the current sublist is rendered as an ordered list. The default is to render as an unordered list.
prefix
An arbitrary HTML string inserted before each value.
suffix
An arbitrary HTML string inserted after each value.

Examples

Nested lists

Table of Contents Next Section