ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
spark.events 

GridSortEvent  - AS3 Flex

Packagespark.events
Classpublic class GridSortEvent
InheritanceGridSortEvent Inheritance Event Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10, AIR 2.5

The GridSortEvent class represents events that are dispatched when the data provider of a Spark DataGrid control is sorted as the result of the user clicking on the header of a column in the DataGrid.

More examples

Learn more

Related API Elements



Public Properties
 PropertyDefined By
 Inheritedbubbles : Boolean
[read-only] Indicates whether an event is a bubbling event.
Event
 Inheritedcancelable : Boolean
[read-only] Indicates whether the behavior associated with the event can be prevented.
Event
  columnIndices : Vector.<int>
The vector of column indices of the sorted columns.
GridSortEvent
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcurrentTarget : Object
[read-only] The object that is actively processing the Event object with an event listener.
Event
 InheritedeventPhase : uint
[read-only] The current phase in the event flow.
Event
  newSortFields : Array
The array of ISortFields for this sort.
GridSortEvent
  oldSortFields : Array
[read-only] The array of ISortFields for the last sort.
GridSortEvent
 Inheritedtarget : Object
[read-only] The event target.
Event
 Inheritedtype : String
[read-only] The type of event.
Event
Public Methods
 MethodDefined By
  
GridSortEvent(type:String, bubbles:Boolean, cancelable:Boolean, columnIndices:Vector.<int>, oldSortFields:Array, newSortFields:Array)
Constructor.
GridSortEvent
 Inherited
Duplicates an instance of an Event subclass.
Event
 Inherited
formatToString(className:String, ... arguments):String
A utility function for implementing the toString() method in custom ActionScript 3.0 Event classes.
Event
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Checks whether the preventDefault() method has been called on the event.
Event
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Cancels an event's default behavior if that behavior can be canceled.
Event
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Prevents processing of any event listeners in the current node and any subsequent nodes in the event flow.
Event
 Inherited
Prevents processing of any event listeners in nodes subsequent to the current node in the event flow.
Event
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns a string containing all the properties of the Event object.
Event
 Inherited
Returns the primitive value of the specified object.
Object
Public Constants
 ConstantDefined By
  SORT_CHANGE : String = "sortChange"
[static] The GridSortEvent.SORT_CHANGE constant defines the value of the type property of the event object for a sortChange event, which indicates that a sort filter has just been applied to the grid's dataProvider collection.
GridSortEvent
  SORT_CHANGING : String = "sortChanging"
[static] The GridSortEvent.SORT_CHANGING constant defines the value of the type property of the event object for a sortChanging event, which indicates that a sort filter is about to be applied to the grid's dataProvider collection.
GridSortEvent
Property Detail

columnIndices

property
public var columnIndices:Vector.<int>

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10, AIR 2.5

The vector of column indices of the sorted columns. If type is GridSelectionEvent.SORT_CHANGING this value can be modified and it will be used to update the grid's columnHeaderGroup visibleSortIndicatorIndices.

Related API Elements

newSortFields

property 
public var newSortFields:Array

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10, AIR 2.5

The array of ISortFields for this sort. If type is GridSelectionEvent.SORT_CHANGING this value can be modified and it will be used to sort the dataProvider of the grid.

Related API Elements

oldSortFields

property 
oldSortFields:Array  [read-only]

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10, AIR 2.5

The array of ISortFields for the last sort. This can be null. The elements in this Array should not be modified.



Implementation
    public function get oldSortFields():Array

Related API Elements

Constructor Detail

GridSortEvent

()Constructor
public function GridSortEvent(type:String, bubbles:Boolean, cancelable:Boolean, columnIndices:Vector.<int>, oldSortFields:Array, newSortFields:Array)

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10, AIR 2.5

Constructor.

Parameters
type:String — The event type; indicates the action that caused the event.
 
bubbles:Boolean — Specifies whether the event can bubble up the display list hierarchy.
 
cancelable:Boolean — Specifies whether the behavior associated with the event can be prevented.
 
columnIndices:Vector.<int> — The vector of column indices of the sorted columns.
 
oldSortFields:Array — The array of ISortFields for the last sort.
 
newSortFields:Array — The array of ISortFields for this sort.
Constant Detail

SORT_CHANGE

Constant
public static const SORT_CHANGE:String = "sortChange"

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10, AIR 2.5

The GridSortEvent.SORT_CHANGE constant defines the value of the type property of the event object for a sortChange event, which indicates that a sort filter has just been applied to the grid's dataProvider collection.

Typically, if a column header mouse click triggered the sort, then the last index of columnIndices is the column's index. Note that interactive sorts are not necessarily triggered by a mouse click.

This event is dispatched when the user interacts with the control. When you sort the data provider's collection programmatically, the component does not dispatch the sortChange event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
columnIndicesThe vector of column indices of the sorted columns.
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myDataGrid.addEventListener() to register an event listener, myDataGrid is the value of the currentTarget.
newSortFieldsThe array of ISortFields for this sort.
oldSortFieldsThe array of ISortFields for the last sort.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
typeGridSelectionEvent.SORT_CHANGE

Related API Elements

SORT_CHANGING

Constant 
public static const SORT_CHANGING:String = "sortChanging"

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10, AIR 2.5

The GridSortEvent.SORT_CHANGING constant defines the value of the type property of the event object for a sortChanging event, which indicates that a sort filter is about to be applied to the grid's dataProvider collection. Call preventDefault() on this event to prevent the sort from occurring or you modify columnIndices and newSortFields if you want to change the default behavior of the sort.

Typically, if a column header mouse click triggered the sort, then the last index of columnIndices is the column's index. Note that interactive sorts are not necessarily triggered by a mouse click.

This event is dispatched when the user interacts with the control. When you sort the data provider's collection programmatically, the component does not dispatch the sortChanging event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
columnIndicesThe vector of column indices of the columns to be sorted.
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myDataGrid.addEventListener() to register an event listener, myDataGrid is the value of the currentTarget.
newSortFieldsThe array of ISortFields for this sort.
oldSortFieldsThe array of ISortFields for the last sort.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
typeGridSelectionEvent.SORT_CHANGING

Related API Elements