     /**
      *  Sort the DataGrid by one or more columns and refresh the display.
      * 
-     *  If the dataProvider is an ICollectionView, then it's sort property will be
+     *  <p>If the dataProvider is an ICollectionView, then it's sort property will be
      *  set to a value based on each column's dataField, sortCompareFunction,
      *  and sortDescending flag, and then the dataProvider's refresh() method will be called.
-     * 
-     *  If the dataProvider is not an ICollectionView, then this method has no effect.
+     *  </p>
+     *  
+     *  <p>If the dataProvider is not an ICollectionView, then this method has no effect.</p>
      * 
      *  @param columnIndices The indices of the columns by which to sort the dataProvider.
      * 

        for each (var columnIndex:int in columnIndices)
        {
            var col:GridColumn = this.getColumnAt(columnIndex);
            
            // columns all must either have a dataField or a labelFunction
            if (!col || (col.dataField == null && col.labelFunction == null))
                return null;
            
            var sortField:SortField = null;
            var sortDescending:Boolean = col.sortDescending;
            var i:int;
            
            // Check if we just sorted this column.
            for (i = 0; i < fields.length; i++)
            {
                if (fields[i].name == col.dataField)
                {
                    // just sorted this column, so flip sortDescending.
                    sortDescending = !fields[i].descending;
                }
            }
            
            // If we haven't sorted by this column yet, check if
            // we've sorted by this column in the previous sort.
            if (!sortField && previousFields)
            {
                for (i = 0; i < previousFields.length; i++)
                {
                    if (previousFields[i].name == col.dataField)
                    {
                        // sortField exists in previous sort, so flip sortDescending.
                        sortField = previousFields[i];
                        sortDescending = !sortField.descending;
                        break;
                    }
                }
            }
            
            // Create a SortField from the column.
            if (!sortField)
                sortField = col.sortField;
            
            col.sortDescending = sortDescending;
            sortField.descending = sortDescending;
            
            fields.push(sortField);
        }
        
        return fields;
    }
    
    //--------------------------------------------------------------------------

import spark.components.gridClasses.GridLayout;
import spark.components.gridClasses.GridSelection;
import spark.components.gridClasses.GridSelectionMode;
import spark.components.gridClasses.GridSortField;
import spark.components.gridClasses.IDataGridElement;
import spark.components.gridClasses.IGridItemEditor;
import spark.components.gridClasses.IGridItemRenderer;
