mx.collections

# IHierarchicalCollectionView - AS3 Flex

Package | mx.collections
Interface | public interface IHierarchicalCollectionView extends ICollectionView , IEventDispatcher
Implementors | HierarchicalCollectionView

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The IHierarchicalCollectionView interface defines an interface for hierarchical or grouped data. Typically, you use this data with the AdvancedDataGrid control.

Related API Elements

mx.controls.AdvancedDataGrid

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | filterFunction : Function A function that the view will use to eliminate items that do not match the function's criteria. | ICollectionView
|  | hasRoot : Boolean [read-only] A flag that, if true, indicates that the current data provider has a root node; for example, a single top-level node in a hierarchical structure. | IHierarchicalCollectionView
|  | length : int [read-only] The number of items in this view. | ICollectionView
|  | openNodes : Object An Array of Objects containing the data provider element for all the open branch nodes of the data. | IHierarchicalCollectionView
|  | showRoot : Boolean A Boolean flag that specifies whether to display the data provider's root node. | IHierarchicalCollectionView
|  | sort : ISort The ISort that will be applied to the ICollectionView. | ICollectionView
|  | source : IHierarchicalData The source data of the IHierarchicalCollectionView. | IHierarchicalCollectionView

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | addChild(parent:Object, newChild:Object):Boolean Adds a child node to a node of the data. | IHierarchicalCollectionView
|  | addChildAt(parent:Object, newChild:Object, index:int):Boolean Adds a child node to a node of the data at a specific index in the data. | IHierarchicalCollectionView
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | IEventDispatcher
|  | closeNode(node:Object):void Closes a node to hide its children. | IHierarchicalCollectionView
|  | contains(item:Object):Boolean Returns whether the view contains the specified object. | ICollectionView
|  | createCursor():IViewCursor Creates a new IViewCursor that works with this view. | ICollectionView
|  | disableAutoUpdate():void Prevents changes to the collection itself and items within the collection from being dispatched by the view. | ICollectionView
|  | dispatchEvent(event:Event):Boolean Dispatches an event into the event flow. | IEventDispatcher
|  | enableAutoUpdate():void Enables auto-updating. | ICollectionView
|  | getChildren(node:Object):ICollectionView Returns a collection of children, if they exist. | IHierarchicalCollectionView
|  | getNodeDepth(node:Object):int Returns the depth of the node in the collection. | IHierarchicalCollectionView
|  | getParentItem(node:Object):* Returns the parent of a node. | IHierarchicalCollectionView
|  | hasEventListener(type:String):Boolean Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | IEventDispatcher
|  | itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void Notifies the view that an item has been updated. | ICollectionView
|  | openNode(node:Object):void Opens a node to display its children. | IHierarchicalCollectionView
|  | refresh():Boolean Applies the sort and filter to the view. | ICollectionView
|  | removeChild(parent:Object, child:Object):Boolean Removes the child node from the parent node. | IHierarchicalCollectionView
|  | removeChildAt(parent:Object, index:int):Boolean Removes the child node from a node at the specified index. | IHierarchicalCollectionView
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void Removes a listener from the EventDispatcher object. | IEventDispatcher
|  | willTrigger(type:String):Boolean Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | IEventDispatcher

Property Detail

### hasRoot

property

`hasRoot:Boolean` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

A flag that, if `true`, indicates that the current data provider has a root node; for example, a single top-level node in a hierarchical structure. XML and Object are examples of data types that have a root node, while Lists and Arrays do not.

Implementation
`public function get hasRoot():Boolean`

### openNodes

property

`openNodes:Object`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

An Array of Objects containing the data provider element for all the open branch nodes of the data.

Implementation
`public function get openNodes():Object`
`public function set openNodes(value:Object):void`

### showRoot

property

`showRoot:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

A Boolean flag that specifies whether to display the data provider's root node. If the source data has a root node, and this property is set to `false`, the collection will not include the root item. Only the descendants of the root item will be included in the collection.

This property has no effect on a source with no root node, such as List and Array objects.

The default value is `true.`

Implementation
`public function get showRoot():Boolean`
`public function set showRoot(value:Boolean):void`

Related API Elements

hasRoot

### source

property

`source:IHierarchicalData`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The source data of the IHierarchicalCollectionView.

Implementation
`public function get source():IHierarchicalData`
`public function set source(value:IHierarchicalData):void`
Method Detail

### addChild

()
method

`public function addChild(parent:Object, newChild:Object):Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Adds a child node to a node of the data.

Parameters

| `parent:Object` — The Object that defines the parent node.
| `newChild:Object` — The Object that defines the new node.

Returns

| `Boolean` — `true` if the node is added successfully.

### addChildAt

()
method

`public function addChildAt(parent:Object, newChild:Object, index:int):Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Adds a child node to a node of the data at a specific index in the data.

Parameters

| `parent:Object` — The Object that defines the parent node.
| `newChild:Object` — The Object that defines the new node.
| `index:int` — The zero-based index of where to insert the child node.

Returns

| `Boolean` — `true` if the node is added successfully.

### closeNode

()
method

`public function closeNode(node:Object):void`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Closes a node to hide its children.

Parameters

| `node:Object` — The Object that defines the node.

### getChildren

()
method

`public function getChildren(node:Object):ICollectionView`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Returns a collection of children, if they exist.

Parameters

| `node:Object` — The Object that defines the node. If `null`, return a collection of top level nodes.

Returns

| `ICollectionView` — ICollectionView instance containing the child nodes.

### getNodeDepth

()
method

`public function getNodeDepth(node:Object):int`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Returns the depth of the node in the collection.

Parameters

| `node:Object` — The Object that defines the node.

Returns

| `int` — The depth of the node.

### getParentItem

()
method

`public function getParentItem(node:Object):*`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Returns the parent of a node. The parent of a top-level node is `null`.

Parameters

| `node:Object` — The Object that defines the node.

Returns

| `*` — The parent node containing the node as child, `null` for a top-level node, and `undefined` if the parent cannot be determined.

### openNode

()
method

`public function openNode(node:Object):void`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Opens a node to display its children.

Parameters

| `node:Object` — The Object that defines the node.

### removeChild

()
method

`public function removeChild(parent:Object, child:Object):Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Removes the child node from the parent node.

Parameters

| `parent:Object` — The Object that defines the parent node, and `null` for top-level nodes.
| `child:Object` — The Object that defines the child node to be removed.

Returns

| `Boolean` — `true` if the node is removed successfully.

### removeChildAt

()
method

`public function removeChildAt(parent:Object, index:int):Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Removes the child node from a node at the specified index.

Parameters

| `parent:Object` — The node object that currently parents the child node. Set `parent` to `null` for top-level nodes.
| `index:int` — The zero-based index of the child node to remove relative to the parent.

Returns

| `Boolean` — `true` if successful, and `false` if not.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00