((Apenas para componentes do Flex Data Visualization))
Pacotemx.collections
Classepublic class GroupingCollection
HerançaGroupingCollection Inheritance HierarchicalData Inheritance EventDispatcher Inheritance Object
Implementa IGroupingCollection

The GroupingCollection class lets you create grouped data from flat data for display in the AdvancedDataGrid control. When you create the instance of the GroupingCollection from your flat data, you specify the field or fields of the data used to create the hierarchy.

To populate the AdvancedDataGrid control with grouped data, you create an instance of the GroupingCollection class from your flat data, and then pass that GroupingCollection instance to the data provider of the AdvancedDataGrid control. To specify the grouping fields of your flat data, you pass a Grouping instance to the GroupingCollection.grouping property. The Grouping instance contains an Array of GroupingField instances, one per grouping field.

The following exemplo uses the GroupingCollection class to define two grouping fields: Region and Territory.

  <mx:AdvancedDataGrid id="myADG"    
    <mx:dataProvider> 
      <mx:GroupingCollection id="gc" source="{dpFlat}"> 
        <mx:grouping> 
          <mx:Grouping> 
            <mx:GroupingField name="Region"/> 
            <mx:GroupingField name="Territory"/> 
          </mx:Grouping> 
        </mx:grouping> 
      </mx:GroupingCollection> 
    </mx:dataProvider>  
     
    <mx:columns> 
      <mx:AdvancedDataGridColumn dataField="Region"/> 
      <mx:AdvancedDataGridColumn dataField="Territory"/> 
      <mx:AdvancedDataGridColumn dataField="Territory_Rep"/> 
      <mx:AdvancedDataGridColumn dataField="Actual"/> 
      <mx:AdvancedDataGridColumn dataField="Estimate"/> 
    </mx:columns> 
  </mx:AdvancedDataGrid>
  

Sintaxe em MXMLexpandedHide MXML Syntax
The <mx.GroupingCollection> inherits all the tag attributes of its superclass, and defines the following tag attributes:

  <mx:GroupingCollection
  Properties 
    grouping="No default"
    source="No default"
    summaries="No default"
  />
  

Default MXML Propertygrouping

Veja também

mx.controls.AdvancedDataGrid
mx.collections.Grouping
mx.collections.GroupingField


Propriedades Públicas
 PropriedadeDefinido por
 InheritedchildrenField : String
Indicates the field name to be used to detect children objects in a data item.
HierarchicalData
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  grouping : Grouping
Specifies the Grouping instance applied to the source data.
GroupingCollection
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  source : Object
The source collection containing the flat data to be grouped.
GroupingCollection
  summaries : Array
Array of SummaryRow instances that define any root-level data summaries.
GroupingCollection
Propriedades Protegidas
 PropriedadeDefinido por
  timer : Timer
The timer which is associated with an asynchronous refresh operation.
GroupingCollection
Métodos Públicos
 MétodoDefinido por
  
Constructor.
GroupingCollection
 Inherited
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.
EventDispatcher
  
If the refresh is performed asynchronously, cancels the refresh operation and stops the building of the groups.
GroupingCollection
 Inherited
HierarchicalData
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
HierarchicalData
 Inherited
HierarchicalData
 Inherited
HierarchicalData
 Inherited
HierarchicalData
  
Return super.source, if the grouping property is set, and an ICollectionView instance that refers to super.source if not.
GroupingCollection
 Inherited
HierarchicalData
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
refresh(async:Boolean = false):Boolean
Applies the grouping to the view.
GroupingCollection
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Eventos
 Evento Descrição Definido por
 Inherited Dispatched when Flash Player or the and AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited Dispatched when Flash Player loses operating system focus and is becoming inactive.EventDispatcher
Detalhes da propriedade
groupingpropriedade
grouping:Grouping  [read-write]

Specifies the Grouping instance applied to the source data. Setting the grouping property does not automatically refresh the view, so you must call the refresh() method after setting this property.


Implementação
    public function get grouping():Grouping
    public function set grouping(value:Grouping):void

Veja também

sourcepropriedade 
source:Object  [read-write]

The source collection containing the flat data to be grouped. If the source is not a collection, it will be auto-wrapped into a collection.


Implementação
    public function get source():Object
    public function set source(value:Object):void
summariespropriedade 
public var summaries:Array

Array of SummaryRow instances that define any root-level data summaries. Specify one or more SummaryRow instances to define the data summaries, as the following exemplo shows:

      <mx:AdvancedDataGrid id="myADG" 
         width="100%" height="100%" 
         initialize="gc.refresh();">        
         <mx:dataProvider>
             <mx:GroupingCollection id="gc" source="{dpFlat}">
                 <mx:summaries>
                     <mx:SummaryRow summaryPlacement="last">
                         <mx:fields>
                             <mx:SummaryField dataField="Actual" 
                                 label="Min Actual" operation="MIN"/>
                             <mx:SummaryField dataField="Actual" 
                                 label="Max Actual" operation="MAX"/>
                         </mx:fields>
                       </mx:SummaryRow>
                     </mx:summaries>
                 <mx:Grouping>
                     <mx:GroupingField name="Region"/>
                     <mx:GroupingField name="Territory"/>
                 </mx:Grouping>
             </mx:GroupingCollection>
         </mx:dataProvider>        
         
         <mx:columns>
             <mx:AdvancedDataGridColumn dataField="Region"/>
             <mx:AdvancedDataGridColumn dataField="Territory_Rep"
                 headerText="Territory Rep"/>
             <mx:AdvancedDataGridColumn dataField="Actual"/>
             <mx:AdvancedDataGridColumn dataField="Estimate"/>
             <mx:AdvancedDataGridColumn dataField="Min Actual"/>
             <mx:AdvancedDataGridColumn dataField="Max Actual"/>
         </mx:columns>
      </mx:AdvancedDataGrid>

Veja também

timerpropriedade 
protected var timer:Timer

The timer which is associated with an asynchronous refresh operation. You can use it to change the timing interval, pause the refresh, or perform other actions. The default value for the delay property of the Timer instance is 1, corresponding to 1 millisecond.

Detalhes do construtor
GroupingCollection()Construtor
public function GroupingCollection()

Constructor.

Detalhes do método
cancelRefresh()método
public function cancelRefresh():void

If the refresh is performed asynchronously, cancels the refresh operation and stops the building of the groups. This method only cancels the refresh if it is initiated by a call to the refresh() method with an argument of true, corresponding to an asynchronous refresh.

getRoot()método 
public override function getRoot():Object

Return super.source, if the grouping property is set, and an ICollectionView instance that refers to super.source if not.

Retorna
Object
refresh()método 
public function refresh(async:Boolean = false):Boolean

Applies the grouping to the view. The IGroupingCollection does not detect changes to a group automatically, so you must call the refresh() method to update the view after setting the group property.

The refresh() method can be applied asynchronously by calling refresh(true).

When refresh() is called synchronously, a client should wait for a CollectionEvent event with the value of the kind property set to CollectionEventKind.REFRESH to ensure that the refresh() method completed.

Parâmetros

async:Boolean (default = false) — If true, defines the refresh to be asynchronous. By default it is false denoting synchronous refresh.

Retorna
Booleantrue if the refresh() method completed, and false if the refresh is incomplete, which can mean that items are still pending.