Apache Flex 4.16.1 API Reference | All Packages | All Classes | Index | Frames No Frames |
MobileGridColumn

Package | spark.components.supportClasses
Class | public class MobileGridColumn
Inheritance | MobileGridColumn flash.events.EventDispatcher

Language Version : | ActionScript 3.0

Product Version : | Flex 4.11

Runtime Versions : | AIR 3.8

| This class is experimental, which means it has not been tested or documented as thoroughly as other core Apache Flex classes.

The MobileGridColumn class defines a column to display in a MobileGrid control.

The MobileGridColumn class specifies the characteristics of the column to display, such as the field of the data provider item whose value is to be displayed in the column. MobileGridColumn takes most of its properties from its parent class and adds the following Grid-specific options:

- headerText and headerStyleName: optional label and style to display in the header for this column.
- sortable, sortDescending and sortField: sorting options for this column.

See also

spark.components.MobileGrid

Public Properties

| Property | Defined By
--- | --- | ---
|  | dataField : String The name of the field or property in the data provider item associated with the column. | MobileGridColumn
|  | headerStyleName : String Defines the css style name to be used for displaying this column's header label. | MobileGridColumn
|  | headerText : String Defines the text to be displayed in the column's header. | MobileGridColumn
|  | itemRenderer : IFactory The class factory for the IMobileGridCellRenderer class used to render individual grid cells. | MobileGridColumn
|  | labelFunction : Function An user-defined function that converts a data provider item into a column-specific string that's used to initialize the item renderer's label property. | MobileGridColumn
|  | percentWidth : Number Specifies the width of this column as a percentage of the grid's width. | MobileGridColumn
|  | sortable : Boolean Flag indicating whether a column can be sorted by clicking on its header. | MobileGridColumn
|  | sortDescending : Boolean | MobileGridColumn
|  | sortField : SortField [read-only] Returns a SortField that can be used to sort a collection by this column's dataField. | MobileGridColumn
|  | styleName : String The css style name to apply to the renderer. | MobileGridColumn
|  | textAlign : String [write-only] Sets the alignment of text renderers. | MobileGridColumn
|  | width : Number Set the desired width for this column. | MobileGridColumn

Public Methods

| Method | Defined By
--- | --- | ---
|  | MobileGridColumn(target:IEventDispatcher = null) | MobileGridColumn

Property Detail

dataField | property

`dataField:String`

The name of the field or property in the data provider item associated with the column. Each GridColumn requires this property or the `labelFunction` property to be set to calculate the displayable text for the item renderer. If the `dataField` and `labelFunction` properties are set, the data is displayed using the `labelFunction` and sorted using the `dataField`.

If the column or its grid specifies a `labelFunction`, then the dataField is not used.

The default value is `null`.

Implementation
`public function get dataField():String`
`public function set dataField(value:String):void`

See also

labelFunction

headerStyleName | property |

`headerStyleName:String`

Defines the css style name to be used for displaying this column's header label.

Use this property to display the header in a different color or font, or with a different text alignment.

This property can be used as the source for data binding.

Implementation
`public function get headerStyleName():String`
`public function set headerStyleName(value:String):void`

headerText | property |

`headerText:String`

Defines the text to be displayed in the column's header.

If this property is not set, the header label will use the value of dataField property instead.

Implementation
`public function get headerText():String`
`public function set headerText(value:String):void`

See also

dataField

itemRenderer | property |

`itemRenderer:IFactory`

The class factory for the IMobileGridCellRenderer class used to render individual grid cells.

The default item renderer is the ItemTextPartRenderer class, which displays the data item as text, optimized for mobile.

You can use also ItemBitmapPartRenderer to display embedded bitmaps, in which case you need to define the iconField or iconFunction

You can also create custom item renderers by deriving any subclass of UIComponent (eg. s:Button) and implementing IMobileGridCellRenderer.

For performance reasons it's preferable that your renderer be written in ActionScript and be as light as possible.

Implementation
`public function get itemRenderer():IFactory`
`public function set itemRenderer(value:IFactory):void`

See also

dataField
spark.components.itemRenderers.MobileGridTextCellRenderer
spark.components.itemRenderers.MobileGridBitmapCellRenderer
spark.components.itemRenderers.IMobileGridCellRenderer

labelFunction | property |

`labelFunction:Function`

An user-defined function that converts a data provider item into a column-specific string that's used to initialize the item renderer's `label` property.

You can use a label function to combine the values of several data provider items into a single string. If specified, this property is used by the `itemToLabel()` method, which computes the value of each item renderer's `label` property in this column.

The function specified to the `labelFunction` property must have the following signature:

    labelFunction(item:Object):String

The `item` parameter is the data provider item for an entire row.

A typical label function could concatenate the firstName and lastName properties of the data provider item , or do some custom formatting on a Date value property.

Implementation
`public function get labelFunction():Function`
`public function set labelFunction(value:Function):void`

percentWidth | property |

`percentWidth:Number`

Specifies the width of this column as a percentage of the grid's width. Allowed values are 0-100. The default value is NaN. If set, this property has precedence over the fixed width property.

MobileGrid will compute the column widths as follows:

- First, honor all columns with fixed widths. Columns with no width or percentWidth receive a width of 100.
- Then distribute the remainder of width between all the columns with percentage widths. If the total of percentages is greater that 100%, it's will be normalized first..

The default value is `NaN`.

Implementation
`public function get percentWidth():Number`
`public function set percentWidth(value:Number):void`

sortable | property |

`sortable:Boolean`

Flag indicating whether a column can be sorted by clicking on its header.

This flag is effective only if the MobileGrid sortableColumn is not set or set to true.

Implementation
`public function get sortable():Boolean`
`public function set sortable(value:Boolean):void`

sortDescending | property |

`sortDescending:Boolean`

Implementation
`public function get sortDescending():Boolean`
`public function set sortDescending(value:Boolean):void`

sortField | property |

`sortField:SortField` [read-only]

Returns a SortField that can be used to sort a collection by this column's `dataField`.

If the `dataField` properties are not defined, but the `labelFunction` property is defined, then it assigns the `compareFunction` to a closure that does a basic string compare on the `labelFunction` applied to the data objects.

Implementation
`public function get sortField():SortField`

styleName | property |

`styleName:String`

The css style name to apply to the renderer.

The style items in the css entry will depend on the renderer. For example, text renderers will accept fontSize, color, fontWeight, etc.

Implementation
`public function get styleName():String`
`public function set styleName(value:String):void`

textAlign | property |

`textAlign:String` [write-only]

Sets the alignment of text renderers. This property is ignored for non-text renderers.

Implementation
`public function set textAlign(value:String):void`

width | property |

`width:Number`

Set the desired width for this column.

Width value is expressed in current applicationDPI, or at 160 DPI if applicationDPI is not set.

Note: You can specify a percentage value in the MXML `width` attribute, such as `width="50%"`, but you cannot use a percentage value in the `width` property in ActionScript. Use the `percentWidth` property instead.

The default value is `100`.

Implementation
`public function get width():Number`
`public function set width(value:Number):void`

See also

percentWidth
Constructor Detail

MobileGridColumn | () | Constructor

`public function MobileGridColumn(target:IEventDispatcher = null)`

Parameters

| `target:IEventDispatcher` (default = `null`)``

Wed Nov 15 2017, 09:50 AM +01:00