class NumberFormat extends Format (View source)

NumberFormat Object

Formats number values in the datatable for display. Added to columns during column definition.

Constants

TYPE

Type of format object

Methods

__construct( array $config = array())

Builds the NumberFormat object with specified options

mixed
__get( string $option)

Get the value of a set option via magic method.

from  JsonConfig
getOptions()

Gets the Options object for the JsonConfig

from  JsonConfig
setOption( string $option, mixed $value)

Shortcut method to set the value of an option and return $this.

from  JsonConfig
setOptions( array $config)

Parses the config array by passing the values through each method to check validity against if the option exists.

from  JsonConfig
array
jsonSerialize()

Custom serialization of the JsonConfig object.

from  JsonConfig
string
getType()

Returns the format type.

from  Format
decimalSymbol( string $decimalSymbol)

Sets the character to use as the decimal marker.

fractionDigits( integer $fractionDigits)

A number specifying how many digits to display after the decimal.

groupingSymbol( string $groupingSymbol)

A character to be used to group digits to the left of the decimal into sets of three.

negativeColor( string $negativeColor)

The text color for negative values.

negativeParens( boolean $negativeParens)

Sets whether negative values should be surrounded by parentheses.

pattern( string $pattern)

A format string. When provided, all other options are ignored, except negativeColor.

prefix( string $prefix)

Sets the string prefix for the value.

suffix( string $suffix)

Sets the string suffix for the value.

Details

at line 55
__construct( array $config = array())

Builds the NumberFormat object with specified options

Parameters

array $config

Exceptions

InvalidConfigValue
InvalidConfigProperty

in JsonConfig at line 64
mixed __get( string $option)

Get the value of a set option via magic method.

Parameters

string $option Name of option.

Return Value

mixed

Exceptions

InvalidConfigProperty

in JsonConfig at line 75
Options getOptions()

Gets the Options object for the JsonConfig

Return Value

Options

in JsonConfig at line 90
JsonConfig setOption( string $option, mixed $value)

Shortcut method to set the value of an option and return $this.

In order to maintain backwards compatibility, ConfigObjects will be unwrapped.

Parameters

string $option Option to set.
mixed $value Value of the option.

Return Value

JsonConfig

in JsonConfig at line 106
setOptions( array $config)

Parses the config array by passing the values through each method to check validity against if the option exists.

Parameters

array $config

Exceptions

InvalidConfigValue
InvalidConfigProperty

in JsonConfig at line 275
array jsonSerialize()

Custom serialization of the JsonConfig object.

Return Value

array

in Format at line 46
string getType()

Returns the format type.

Return Value

string

at line 70
NumberFormat decimalSymbol( string $decimalSymbol)

Sets the character to use as the decimal marker.

The default is a dot (.)

Parameters

string $decimalSymbol

Return Value

NumberFormat

Exceptions

InvalidConfigValue

at line 87
NumberFormat fractionDigits( integer $fractionDigits)

A number specifying how many digits to display after the decimal.

The default is 2. If you specify more digits than the number contains, it will display zeros for the smaller values. Truncated values will be rounded (5 rounded up).

Parameters

integer $fractionDigits

Return Value

NumberFormat

Exceptions

InvalidConfigValue

at line 100
NumberFormat groupingSymbol( string $groupingSymbol)

A character to be used to group digits to the left of the decimal into sets of three.

Default is a comma (,)

Parameters

string $groupingSymbol

Return Value

NumberFormat

Exceptions

InvalidConfigValue

at line 115
NumberFormat negativeColor( string $negativeColor)

The text color for negative values.

No default value & values can be any acceptable HTML color value, such as "red" or "#FF0000".

Parameters

string $negativeColor Valid HTML color

Return Value

NumberFormat

Exceptions

InvalidConfigValue

at line 129
NumberFormat negativeParens( boolean $negativeParens)

Sets whether negative values should be surrounded by parentheses.

Default is true.

Parameters

boolean $negativeParens

Return Value

NumberFormat

Exceptions

InvalidConfigValue

at line 146
NumberFormat pattern( string $pattern)

A format string. When provided, all other options are ignored, except negativeColor.

The format string is a subset of the ICU pattern set. For instance, {pattern:'#,###%'} will result in output values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5.

Parameters

string $pattern

Return Value

NumberFormat

Exceptions

InvalidConfigValue

See also

http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details

at line 158
NumberFormat prefix( string $prefix)

Sets the string prefix for the value.

Parameters

string $prefix

Return Value

NumberFormat

Exceptions

InvalidConfigValue

at line 170
NumberFormat suffix( string $suffix)

Sets the string suffix for the value.

Parameters

string $suffix

Return Value

NumberFormat

Exceptions

InvalidConfigValue