This class represents the Unit composite type.
Constructor for a Unit type.
new sap.ui.model.type.Unit(oFormatOptions?, oConstraints?, aDynamicFormatOptionNames?)
Param | Type | Default Value | Description |
---|---|---|---|
oFormatOptions? | object | Formatting options. For a list of all available options, see NumberFormat. If the format options |
|
preserveDecimals? | boolean | true | By default decimals are preserved, unless |
source? | object | Additional set of format options to be used if the property in the model is not of type |
|
oConstraints? | object | Value constraints |
|
minimum? | float | Smallest value allowed for this type |
|
maximum? | float | Largest value allowed for this type |
|
decimals? | float | Largest number of decimals allowed for this type |
|
aDynamicFormatOptionNames? | array | keys for dynamic format options which are used to map additional binding values, e.g. |
Method | Description |
---|---|
sap.ui.model.type.Unit.extend |
Creates a new subclass of class sap.ui.model.type.Unit with name
|
formatValue |
Format the given array containing measure and unit code to an output value of type string. Other internal types than 'string' are not supported by the Unit type. If a source format has been defined for this type, the formatValue does also accept a string value as input, which will be parsed into an array using the source format. If vValues is not defined or null, null will be returned. |
sap.ui.model.type.Unit.getMetadata |
Returns a metadata object for class sap.ui.model.type.Unit. |
getPartsIgnoringMessages |
Gets an array of indices that determine which parts of this type shall not propagate their model messages to the attached control. Prerequisite is that the corresponding binding supports this feature, see sap.ui.model.Binding#supportsIgnoreMessages. If the format option
|
parseValue |
Parse a string value to an array containing measure and unit. Parsing of other internal types than 'string' is not supported by the Unit type. In case a source format has been defined, after parsing the Unit is formatted using the source format and a string value is returned instead. |
Creates a new subclass of class sap.ui.model.type.Unit with name sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.model.CompositeType.extend.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Format the given array containing measure and unit code to an output value of type string. Other internal types than 'string' are not supported by the Unit type. If a source format has been defined for this type, the formatValue does also accept a string value as input, which will be parsed into an array using the source format. If vValues is not defined or null, null will be returned.
Param | Type | DefaultValue | Description |
---|---|---|---|
vValue | array string |
the array of values or string value to be formatted. If an array is given, index 0 is the number value, and index 1 is the Unit code (CLDR or custom). Indices 2+ are the bound values for the dynamic format options. |
|
sInternalType | string |
the target type |
Gets an array of indices that determine which parts of this type shall not propagate their model messages to the attached control. Prerequisite is that the corresponding binding supports this feature, see sap.ui.model.Binding#supportsIgnoreMessages. If the format option showMeasure
is set to false
and the unit value is not shown in the control, the part for the unit code shall not propagate model messages to the control. Analogously, if the format option showNumber
is set to false
, the measure is not shown in the control and the part for the measure shall not propagate model messages to the control.
References:
Parse a string value to an array containing measure and unit. Parsing of other internal types than 'string' is not supported by the Unit type. In case a source format has been defined, after parsing the Unit is formatted using the source format and a string value is returned instead.
Param | Type | DefaultValue | Description |
---|---|---|---|
vValue | any |
the value to be parsed |
|
sInternalType | string |
the source type |
|
aCurrentValues | array |
Not used |