Paquete | mx.collections |
Clase | public class GroupingCollection2 |
Herencia | GroupingCollection2 HierarchicalData EventDispatcher Object |
Implementa | IGroupingCollection2 |
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 4 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Note: In the previous release of Flex, you used the GroupingCollection class with the AdvancedDataGrid control. The GroupingCollection2 class is new for Flex 4 and provides better performance than GroupingCollection.
To populate the AdvancedDataGrid control with grouped data,
you create an instance of the GroupingCollection2 class from your flat data,
and then pass that GroupingCollection2 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 GroupingCollection2.grouping
property.
The Grouping instance contains an Array of GroupingField instances,
one per grouping field.
The following example uses the GroupingCollection2 class to define two grouping fields: Region and Territory.
<mx:AdvancedDataGrid id="myADG" <mx:dataProvider> <mx:GroupingCollection2 id="gc" source="{dpFlat}"> <mx:grouping> <mx:Grouping> <mx:GroupingField name="Region"/> <mx:GroupingField name="Territory"/> </mx:Grouping> </mx:grouping> </mx:GroupingCollection2> </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>Sintaxis MXMLOcultar sintaxis MXML
<mx.GroupingCollection2>
inherits all the tag attributes of its superclass,
and defines the following tag attributes:
<mx:GroupingCollection2 Properties grouping="No default" source="No default" summaries="No default" />
Propiedad MXML predeterminadagrouping
Más ejemplos
Using synchronous or asynchronous refresh with the AdvancedDataGrid control
Using the default MXML property of the GroupingCollection2 class
Creating summary rows
Elementos de API relacionados
Propiedad | Definido por | ||
---|---|---|---|
childrenField : String
Indicates the field name to be used to detect children objects in
a data item. | HierarchicalData | ||
constructor : Object
Una referencia a la clase de objeto o función constructora para una instancia de objeto determinada. | Object | ||
grouping : Grouping
Specifies the Grouping instance applied to the source data. | GroupingCollection2 | ||
source : Object [override]
The source collection containing the flat data to be grouped. | GroupingCollection2 | ||
summaries : Array
Array of SummaryRow instances that define any root-level data summaries. | GroupingCollection2 |
Propiedad | Definido por | ||
---|---|---|---|
timer : flash.utils:Timer
The timer which is associated with an asynchronous refresh operation. | GroupingCollection2 |
Método | Definido por | ||
---|---|---|---|
Constructor. | GroupingCollection2 | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registra un objeto de detector de eventos con un objeto EventDispatcher, de modo que el detector reciba la notificación de un evento. | EventDispatcher | ||
If the refresh is performed asynchronously,
cancels the refresh operation and stops the building of the groups. | GroupingCollection2 | ||
Returns true if the node can contain children. | HierarchicalData | ||
Distribuye un evento en el flujo del evento. | EventDispatcher | ||
Returns an Object representing the node's children. | HierarchicalData | ||
Returns data from a node. | HierarchicalData | ||
[override]
Return super.source, if the grouping property is set,
and an ICollectionView instance that refers to super.source if not. | GroupingCollection2 | ||
Returns true if the node has children. | HierarchicalData | ||
Comprueba si el objeto EventDispatcher tiene detectores registrados para un tipo concreto de evento. | EventDispatcher | ||
Indica si un objeto tiene definida una propiedad especificada. | Object | ||
Indica si hay una instancia de la clase Object en la cadena de prototipo del objeto especificado como parámetro. | Object | ||
Indica si existe la propiedad especificada y si es enumerable. | Object | ||
Applies the grouping to the collection. | GroupingCollection2 | ||
Elimina un detector del objeto EventDispatcher. | EventDispatcher | ||
Establece la disponibilidad de una propiedad dinámica para operaciones de bucle. | Object | ||
Devuelve la representación de cadena de este objeto, con formato según las convenciones específicas de configuración regional. | Object | ||
Devuelve la representación de cadena del objeto especificado. | Object | ||
Devuelve el valor simple del objeto especificado. | Object | ||
Comprueba si hay registrado un detector de eventos con este objeto EventDispatcher o con cualquiera de sus ascendientes para el tipo de evento concreto. | EventDispatcher |
Método | Definido por | ||
---|---|---|---|
Returns the parent of a node. | GroupingCollection2 |
grouping | propiedad |
grouping:Grouping
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 3 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
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.
Implementación
public function get grouping():Grouping
public function set grouping(value:Grouping):void
Elementos de API relacionados
source | propiedad |
source:Object
[override] Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 3 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
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.
Implementación
override public function get source():Object
override public function set source(value:Object):void
summaries | propiedad |
public var summaries:Array
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 3 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
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 example shows:
<mx:AdvancedDataGrid id="myADG" width="100%" height="100%" initialize="gc.refresh();"> <mx:dataProvider> <mx:GroupingCollection2 id="gc" source="{dpFlat}"> <mx:summaries> <mx:SummaryRow summaryPlacement="last"> <mx:fields> <mx:SummaryField2 dataField="Actual" label="Min Actual" summaryOperation="MIN"/> <mx:SummaryField2 dataField="Actual" label="Max Actual" summaryOperation="MAX"/> </mx:fields> </mx:SummaryRow> </mx:summaries> <mx:Grouping> <mx:GroupingField name="Region"/> <mx:GroupingField name="Territory"/> </mx:Grouping> </mx:GroupingCollection2> </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>
Elementos de API relacionados
timer | propiedad |
protected var timer:flash.utils:Timer
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 3 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
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.
GroupingCollection2 | () | Información sobre |
public function GroupingCollection2()
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 3 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Constructor.
cancelRefresh | () | método |
public function cancelRefresh():void
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 3 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
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 asynch
argument of true
, corresponding to an asynchronous refresh.
getParent | () | método |
protected function getParent(node:Object):*
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 3 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Returns the parent of a node.
The parent of a top-level node is null
.
Parámetros
node:Object — The Object that defines the node.
|
* — The parent node containing the node as child,
null for a top-level node,
and undefined if the parent cannot be determined.
|
getRoot | () | método |
override public function getRoot():Object
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 3 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Return super.source
, if the grouping
property is set,
and an ICollectionView instance that refers to super.source
if not.
Object — The object to return.
|
refresh | () | método |
public function refresh(async:Boolean = false, dispatchCollectionEvents:Boolean = false):Boolean
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 3 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Applies the grouping to the collection.
The collection does not detect changes to a group
automatically, so you must call the refresh()
method to update the collection after setting the grouping
,
source
, or summaries
properties.
You also call the refresh()
method when you modify
a GroupingField of the collection, such as by changing the
caseInsensitive
, compareFunction
,
or groupingFunction
properties.
The refresh()
method can be applied synchronously
or asynchronously.
When refresh()
is called synchronously,
all groups and summaries are updated together before the method returns.
That means your application cannot perform other processing operations
for the duration of the call.
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.
In asynchronous refresh, all groups and summaries are updated individually.
The refresh()
method returns before the groups and summaries
are updated so that your application can continue execution.
Also, the control is updated during the refresh so that the
user can continue to interact with it.
The overhead of updating groups and summaries individually, rather than all at once, makes an asynchronous refresh take longer than a synchronous one. However, for large data sets, your application continues to operate during the refresh.
Parámetros
async:Boolean (default = false ) — If true , defines the refresh to be asynchronous.
By default it is false denoting synchronous refresh.
| |
dispatchCollectionEvents:Boolean (default = false ) — If true , events are
dispatched when groups are formed.
For better performance, set it to false .
If true , then events are dispatched as groups and summaries are calculated
synchronously to update the control.
Note: If async is true ,
the dispatchCollectionEvents is always set to true .
By default it is false denoting no events will be dispatched.
|
Boolean — true if the refresh() method completed,
and false if the refresh is incomplete,
which can mean that items are still pending.
|
Tue Jun 12 2018, 02:12 PM Z