套件 | mx.collections |
類別 | public class HierarchicalCollectionView |
繼承 | HierarchicalCollectionView EventDispatcher Object |
實作 | IHierarchicalCollectionView, IXMLNotifiable |
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
<mx.HierarchicalCollectionView>
inherits all the tag attributes of its superclass,
and defines the following tag attributes:
<mx:HierarchicalCollectionView Properties showRoot="true|false" source="No default" />
屬性 | 定義自 | ||
---|---|---|---|
constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | ||
hasRoot : Boolean [唯讀]
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. | HierarchicalCollectionView | ||
length : int [唯讀]
The length of the currently parsed collection. | HierarchicalCollectionView | ||
openNodes : Object
An Array of Objects containing the data provider element
for all the open branch nodes of the data. | HierarchicalCollectionView | ||
showRoot : Boolean
A Boolean flag that specifies whether to display the data provider's root node. | HierarchicalCollectionView | ||
source : IHierarchicalData
The source data of the IHierarchicalCollectionView. | HierarchicalCollectionView |
方法 | 定義自 | ||
---|---|---|---|
Constructor. | HierarchicalCollectionView | ||
Adds a child node to a node of the data. | HierarchicalCollectionView | ||
Add a child node to a node at the specified index. | HierarchicalCollectionView | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。 | EventDispatcher | ||
Closes a node to hide its children. | HierarchicalCollectionView | ||
Checks the collection for the data item using standard equality test. | HierarchicalCollectionView | ||
Returns a new instance of a view iterator over the items in this view. | HierarchicalCollectionView | ||
會將事件傳送到事件流程。 | EventDispatcher | ||
Returns a collection of children, if they exist. | HierarchicalCollectionView | ||
Returns the depth of the node in the collection. | HierarchicalCollectionView | ||
Returns the parent of a node. | HierarchicalCollectionView | ||
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。 | EventDispatcher | ||
指出物件是否有已定義的指定屬性。 | Object | ||
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | ||
Opens a node to display its children. | HierarchicalCollectionView | ||
指出指定的屬性是否存在,以及是否可列舉。 | Object | ||
Applies the sort and filter to the view. | HierarchicalCollectionView | ||
Removes the child node from the parent node. | HierarchicalCollectionView | ||
Removes the child node from a node at the specified index. | HierarchicalCollectionView | ||
會從 EventDispatcher 物件移除偵聽程式。 | EventDispatcher | ||
為迴圈作業設定動態屬性的可用性。 | Object | ||
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | ||
會傳回指定之物件的字串形式。 | Object | ||
會傳回指定之物件的基本值。 | Object | ||
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。 | EventDispatcher |
hasRoot | 屬性 |
hasRoot:Boolean
[唯讀] 語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | 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.
實作
public function get hasRoot():Boolean
length | 屬性 |
openNodes | 屬性 |
showRoot | 屬性 |
showRoot:Boolean
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | 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.
預設值為 true。
此屬性可以做為資料繫結的來源。一旦修改此屬性,將傳送 propertyChange
事件。
實作
public function get showRoot():Boolean
public function set showRoot(value:Boolean):void
source | 屬性 |
source:IHierarchicalData
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The source data of the IHierarchicalCollectionView.
實作
public function get source():IHierarchicalData
public function set source(value:IHierarchicalData):void
HierarchicalCollectionView | () | 建構函式 |
public function HierarchicalCollectionView(hierarchicalData:IHierarchicalData = null, argOpenNodes:Object = null)
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Constructor.
參數hierarchicalData:IHierarchicalData (default = null ) — The data structure containing the hierarchical data.
| |
argOpenNodes:Object (default = null ) — The Object that defines a node to appear as open.
|
addChild | () | 方法 |
public function addChild(parent:Object, newChild:Object):Boolean
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Adds a child node to a node of the data.
參數
parent:Object — The Object that defines the parent node.
| |
newChild:Object — The Object that defines the new node.
|
Boolean — true if the node is added successfully.
|
addChildAt | () | 方法 |
public function addChildAt(parent:Object, newChild:Object, index:int):Boolean
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Add a child node to a node at the specified index. This implementation does the following:
- If the
parent
is null or undefined, inserts thechild
at the specifiedindex
in the collection specified bysource
. - If the
parent
has achildren
field or property, the method adds thechild
to it at theindex
location. In this case, thesource
is not required. - If the
parent
does not have achildren
field or property, the method adds thechildren
to theparent
. The method then adds thechild
to the parent at theindex
location. In this case, thesource
is not required. - If the
index
value is greater than the collection length or number of children in the parent, adds the object as the last child.
參數
parent:Object — The Object that defines the parent node.
| |
newChild:Object — The Object that defines the child node.
| |
index:int — The 0-based index of where to insert the child node.
|
Boolean — true if the child is added successfully.
|
closeNode | () | 方法 |
contains | () | 方法 |
public function contains(item:Object):Boolean
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Checks the collection for the data item using standard equality test.
參數
item:Object — The Object that defines the node to look for.
|
Boolean — true if the data item is in the collection,
and false if not.
|
createCursor | () | 方法 |
public function createCursor():IViewCursor
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Returns a new instance of a view iterator over the items in this view.
傳回值IViewCursor — IViewCursor instance.
|
相關 API 元素
getChildren | () | 方法 |
public function getChildren(node:Object):ICollectionView
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Returns a collection of children, if they exist.
參數
node:Object — The Object that defines the node.
If null , return a collection of top level nodes.
|
ICollectionView — ICollectionView instance containing the child nodes.
|
getNodeDepth | () | 方法 |
getParentItem | () | 方法 |
public function getParentItem(node:Object):*
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Returns the parent of a node.
The parent of a top-level node is null
.
參數
node:Object — The Object that defines the node.
|
* — The parent node containing the node,
null for a top-level node,
and undefined if the parent cannot be determined.
|
openNode | () | 方法 |
refresh | () | 方法 |
public function refresh():Boolean
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Applies the sort and filter to the view.
The ICollectionView does not detect changes to a sort or
filter automatically, so you must call the refresh()
method to update the view after setting the sort
or filterFunction
property.
If your ICollectionView implementation also implements
the IMXMLObject interface, you should to call the
refresh()
method from your initialized()
method.
Returns true
if the refresh was successful
and false
if the sort is not yet complete
(e.g., items are still pending).
A client of the view should wait for a CollectionEvent event
with the CollectionEventKind.REFRESH
kind
property to ensure that the refresh()
operation is
complete.
Boolean — true if the refresh() was complete,
false if the refresh() is incomplete.
|
removeChild | () | 方法 |
public function removeChild(parent:Object, child:Object):Boolean
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Removes the child node from the parent node.
參數
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.
|
Boolean — true if the node is removed successfully.
|
removeChildAt | () | 方法 |
public function removeChildAt(parent:Object, index:int):Boolean
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Removes the child node from a node at the specified index.
參數
parent:Object — The Object that defines the parent node.
| |
index:int — The 0-based index of the child node to remove relative to the parent.
|
Boolean — true if the child is removed successfully.
|
Tue Jun 12 2018, 03:47 PM Z