Packageorg.juicekit.util.helper
Classpublic class Formatter

The Formatter class methods produce labeling functions for use as values for a DataGridColumn labelFunction property.



Public Methods
 MethodDefined by
  
arrayIndexProperty(item:Object, column:DataGridColumn):String
[static] Provided as an auxillary function to access an array-based named property value as a String.
Formatter
  
dataGridLabelFunction(fmt:String, formatField:String = ""):Function
[static]

Creates a labeling function used by a DataGridColumn instance using Strings.format conventions.

Formatter
Method detail
arrayIndexProperty()method
public static function arrayIndexProperty(item:Object, column:DataGridColumn):String

Provided as an auxillary function to access an array-based named property value as a String. Intended to be assigned to a DataGridColumn's labelFunction property.

Parameters
item:Object
 
column:DataGridColumn

Returns
String
dataGridLabelFunction()method 
public static function dataGridLabelFunction(fmt:String, formatField:String = ""):Function

Creates a labeling function used by a DataGridColumn instance using Strings.format conventions. This follows the String formatting conventions of the .NET framework. An overview can be found here. This formatting convention is very similar to Microsoft Excel custom formats.

Parameters
fmt:String — a formatting string. The formatting string will be receive only a single argument item[column.dataField] where item is the object representing the current row of the DataGrid and column represents the current column. fmt can take two forms. Form one: a simple picture like "0.00". In this case fmt will be wrapped in '{0:'+fmt+'}'. Form two: a complete formatting string like '{0:0.00} widgets'.
 
formatField:String (default = "") — an optional field that contains a formatting string. This will be evaluated using the same rules as fmt.

Returns
Function — A formatting function suitable for use as a DataGrid.labelFunction

See also

flare.util.Strings