  *  @productversion Flex 4.5
  */
 [Event(name="selectionChange", type="spark.events.GridSelectionEvent")]
+
+/**
+ *  Dispatched before the sort has been applied to the data provder's collection.
+ *  Calling the <code>preventDefault()</code> method
+ *  on the event prevents the sort from being applied.
+ *  Alternatively you can modify the <code>columnIndices</code> and 
+ *  <code>newSortFields</code> paramters of the event if you want to change the default 
+ *  behavior of the sort.
+ *  
+ *  <p>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 <code>sortChanging</code> event. </p>
+ *
+ *  @eventType spark.events.GridSelectionEvent.SORT_CHANGING
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Event(name="sortChanging", type="spark.events.GridSortEvent")]
+
+/**
+ *  Dispatched after the sort has been applied to the data provder's collection. 
+ *  
+ *  <p>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 <code>sortChanging</code> event.
+ *  In either case it dispatches the <code>valueCommit</code> event as well.</p>
+ *
+ *  @eventType spark.events.GridSelectionEvent.SELECTION_CHANGE
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Event(name="sortChange", type="spark.events.GridSortEvent")]
 
 //--------------------------------------
 //  Edit Events

 *  <p>This event is dispatched when the user interacts with the control.
 *  When you change the selection programmatically, 
 *  the component does not dispatch the <code>selectionChange</code> event. 
 *  It dispatches the <code>valueCommit</code> event instead.</p>
 *
 *  @eventType spark.events.GridSelectionEvent.SELECTION_CHANGE
 *  

            // we've sorted by this column in the previous sort.
            if (!sortField && previousFields)
                sortField = findSortField(dataField, previousFields, isComplexDataField);
            else
                preservePrevious = false;
                
            // Previously sorted column, so flip sortDescending.
            if (sortField)
                sortDescending = !sortField.descending;
            
            // Create a SortField from the column.  If the sortField was found in the
            // previousFields and we need to preserve them, create a new sort field for the column.
            if (!sortField || preservePrevious)
                sortField = col.sortField;
                        
            col.sortDescending = sortDescending;
            sortField.descending = sortDescending;
            fields.push(sortField);
