Packagefeathers.controls
Classpublic class DataGridColumn
InheritanceDataGridColumn Inheritance starling.events.EventDispatcher

Product Version : Feathers 3.4.0

Configures a column in a DataGrid component.

See also

feathers.controls.DataGrid


Public Properties
 PropertyDefined By
  cellRendererFactory : Function
A function called that is expected to return a new cell renderer.
DataGridColumn
  customCellRendererStyleName : String
A style name to add to all cell renderers in this column.
DataGridColumn
  customHeaderRendererStyleName : String
A style name to add to all header renderers in this column.
DataGridColumn
  dataField : String
The field in the item that contains the data to be displayed by the cell renderers in this column.
DataGridColumn
  headerRendererFactory : Function
A function called that is expected to return a new header renderer.
DataGridColumn
  headerText : String
The text to display in the column's header.
DataGridColumn
  minWidth : Number
The minimum width of the column, in pixels.
DataGridColumn
  resizable : Boolean
Indicates if the column may be resized by dragging from its right edge.
DataGridColumn
  sortCompareFunction : Function
A function to compare each item in the collection to determine the order when sorted.
DataGridColumn
  sortOrder : String
Indicates if the column may be sorted by triggering the header renderer, and which direction it should be sorted by default (ascending or descending).
DataGridColumn
  width : Number
The width of the column, in pixels.
DataGridColumn
Public Methods
 MethodDefined By
  
DataGridColumn(dataField:String = null, headerText:String = null)
Constructor.
DataGridColumn
Events
 Event Summary Defined By
  Dispatched when a property of the column changes.DataGridColumn
Property Detail
cellRendererFactoryproperty
cellRendererFactory:Function

A function called that is expected to return a new cell renderer.

The function is expected to have the following signature:

function():IDataGridCellRenderer

The following example provides a factory for the cell renderer:

column.cellRendererFactory = function():IDataGridCellRenderer
{
    var cellRenderer:CustomCellRendererClass = new CustomCellRendererClass();
    cellRenderer.backgroundSkin = new Quad( 10, 10, 0xff0000 );
    return cellRenderer;
};

The default value is null.


Implementation
    public function get cellRendererFactory():Function
    public function set cellRendererFactory(value:Function):void

See also

customCellRendererStyleNameproperty 
customCellRendererStyleName:String

A style name to add to all cell renderers in this column. Typically used by a theme to provide different skins to different columns.

The following example sets the cell renderer style name:

column.customCellRendererStyleName = "my-custom-cell-renderer";

In your theme, you can target this sub-component name to provide different skins than the default style:

getStyleProviderForClass( DefaultDataGridCellRenderer ).setFunctionForStyleName( "my-custom-cell-renderer", setCustomCellRendererStyles );

The default value is null.


Implementation
    public function get customCellRendererStyleName():String
    public function set customCellRendererStyleName(value:String):void

See also

customHeaderRendererStyleNameproperty 
customHeaderRendererStyleName:String

A style name to add to all header renderers in this column. Typically used by a theme to provide different skins to different columns.

The following example sets the header renderer name:

column.customHeaderRendererStyleName = "my-custom-header-renderer";

In your theme, you can target this sub-component name to provide different skins than the default style:

getStyleProviderForClass( DefaultDataGridHeaderRenderer ).setFunctionForStyleName( "my-custom-header-renderer", setCustomHeaderRendererStyles );

The default value is null.


Implementation
    public function get customHeaderRendererStyleName():String
    public function set customHeaderRendererStyleName(value:String):void

See also

dataFieldproperty 
dataField:String

The field in the item that contains the data to be displayed by the cell renderers in this column. If the item does not have this field, then the renderer may default to calling toString() on the item.

In the following example, the data field is customized:

column.dataField = "name";

The default value is null.


Implementation
    public function get dataField():String
    public function set dataField(value:String):void
headerRendererFactoryproperty 
headerRendererFactory:Function

A function called that is expected to return a new header renderer.

The function is expected to have the following signature:

function():IDataGridHeaderRenderer

The following example provides a factory for the header renderer:

column.headerRendererFactory = function():IDataGridHeaderRenderer
{
    var headerRenderer:CustomHeaderRendererClass = new CustomHeaderRendererClass();
    headerRenderer.backgroundSkin = new Quad( 10, 10, 0xff0000 );
    return headerRenderer;
};

The default value is null.


Implementation
    public function get headerRendererFactory():Function
    public function set headerRendererFactory(value:Function):void

See also

headerTextproperty 
headerText:String

The text to display in the column's header.

In the following example, the header text is customized:

column.headerText = "Customer Name";

The default value is null.


Implementation
    public function get headerText():String
    public function set headerText(value:String):void
minWidthproperty 
minWidth:Number

The minimum width of the column, in pixels.

The following example sets the column minimum width:

column.minWidth = 200;

The default value is 10.


Implementation
    public function get minWidth():Number
    public function set minWidth(value:Number):void
resizableproperty 
resizable:Boolean

Indicates if the column may be resized by dragging from its right edge.

If the resizableColumns property of the DataGrid is false, it takes precendence over this property, and the column will not be resizable.

The following example disables resizing:

column.resizable = false;

The default value is true.


Implementation
    public function get resizable():Boolean
    public function set resizable(value:Boolean):void

See also

sortCompareFunctionproperty 
sortCompareFunction:Function

A function to compare each item in the collection to determine the order when sorted.

The function is expected to have the following signature:

function( a:Object, b:Object ):int

The return value should be -1 if the first item should appear before the second item when the collection is sorted. The return value should be 1 if the first item should appear after the second item when the collection in sorted. Finally, the return value should be 0 if both items have the same sort order.

The default value is null.


Implementation
    public function get sortCompareFunction():Function
    public function set sortCompareFunction(value:Function):void

See also

sortOrderproperty 
sortOrder:String

Indicates if the column may be sorted by triggering the header renderer, and which direction it should be sorted by default (ascending or descending).

Setting this property will not start a sort. It only provides the initial order of the sort when triggered by the user.

If the sortableColumns property of the DataGrid is false, it takes precendence over this property, and the column will not be sortable.

The following example disables sorting:

column.sortOrder = SortOrder.NONE;

The default value is feathers.data.SortOrder.ASCENDING.


Implementation
    public function get sortOrder():String
    public function set sortOrder(value:String):void

See also

widthproperty 
width:Number

The width of the column, in pixels. If the width is set to NaN, the column will be sized automatically by the data grid's layout.

The following example sets the column width:

column.width = 200;

The default value is NaN.


Implementation
    public function get width():Number
    public function set width(value:Number):void
Constructor Detail
DataGridColumn()Constructor
public function DataGridColumn(dataField:String = null, headerText:String = null)

Constructor.

Parameters
dataField:String (default = null)
 
headerText:String (default = null)
Event Detail
change Event
Event Object Type: starling.events.Event
Event.type property = starling.events.Event.CHANGE

Dispatched when a property of the column changes.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
datanull
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.