Apache Flex 4.16.0 API Reference | All Packages | All Classes | Index | Frames No Frames |
LabelUtil

Package | spark.utils
Class | public class LabelUtil
Inheritance | LabelUtil Object

Language Version : | ActionScript 3.0

Product Version : | Flex 4

Runtime Versions : | Flash Player 10, AIR 1.5

The LabelUtil class is used by components to determine the correct text to display for their renderers or sub-parts.

Public Methods

| Method | Defined By
--- | --- | ---
|  | itemToLabel(item:Object, labelField:String = null, labelFunction:Function = null):String [static] A function used by components that support item renderers to determine the correct text an item renderer should display for a data item. | LabelUtil

Method Detail

itemToLabel | () | method

`public static function itemToLabel(item:Object, labelField:String = null, labelFunction:Function = null):String`

Language Version : | ActionScript 3.0

Product Version : | Flex 4

Runtime Versions : | Flash Player 10, AIR 1.5

A function used by components that support item renderers to determine the correct text an item renderer should display for a data item. If no `labelField` or `labelFunction` parameter is specified, the `toString()` method of the data item is called to return a String representation of the data item.

The `labelFunction` property takes a reference to a function. The function takes a single argument which is the item in the data provider and returns a String:

          myLabelFunction(item:Object):String

Parameters

| `item:Object` — The data item. Null items return the empty string.
| `labelField:String` (default = `null`)`` — The field in the data item to return. If labelField is set to an empty string (""), no field will be considered on the data item to represent label.
| `labelFunction:Function` (default = `null`)`` — A function that takes the data item as a single parameter and returns a String.

Returns

| `String` — A String representation for the data item

Sun Mar 5 2017, 03:42 PM +11:00