A text view which displays currency values and aligns them at the decimal point.
The currency control consists of an amount, which is formatted automatically according to the user’s locale (using delimiter symbols for the decimal point and thousand separators) and to the currency set for this specific number (number of decimal places).
The currency is expressed as a three-letter code.
When to use
When not to use
The control supports amounts smaller than 100 trillion, which still fit on a phone screen in portrait mode. For larger amounts, the unit of measurement wraps to the next line, which makes it difficult to compare the amounts.
Constructor for a new Currency
.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.
new sap.ui.unified.Currency(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | ID for the new control, generated automatically if no ID is given |
|
mSettings? | object | Initial settings for the new control |
Name | Type | Default Value | Description |
---|---|---|---|
currency | string | Determines the displayed currency code (ISO 4217). Note: If a * character is set instead of currency code, only the character itself will be rendered, ignoring the |
|
emptyIndicatorMode | sap.m.EmptyIndicatorMode | Off | Specifies if an empty indicator should be displayed when there is no text. |
maxPrecision | int | Defines the space that is available for the precision of the various currencies. Visibility: public |
|
stringValue | string | Determines the currency value as a string. String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the Note: If set, it will take precedence over the |
|
useSymbol | boolean | true | Displays the currency symbol instead of the ISO currency code. Visibility: public |
value | float | 0 | Determines the currency value. Visibility: public |
Method | Description |
---|---|
sap.ui.unified.Currency.extend |
Creates a new subclass of class sap.ui.unified.Currency with name
|
getAccessibilityInfo |
References:
|
getCurrency |
Gets current value of property currency. Determines the displayed currency code (ISO 4217). Note: If a * character is set instead of currency code, only the character itself will be rendered, ignoring the |
getCurrencySymbol |
Get symbol of the currency, if available. |
getEmptyIndicatorMode |
Gets current value of property emptyIndicatorMode. Specifies if an empty indicator should be displayed when there is no text. Default value is |
getFormattedValue |
The formatted value. |
getMaxPrecision |
Gets current value of property maxPrecision. Defines the space that is available for the precision of the various currencies. |
sap.ui.unified.Currency.getMetadata |
Returns a metadata object for class sap.ui.unified.Currency. |
getStringValue |
Gets current value of property stringValue. Determines the currency value as a string. String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the Note: If set, it will take precedence over the |
getUseSymbol |
Gets current value of property useSymbol. Displays the currency symbol instead of the ISO currency code. Default value is |
getValue |
Gets current value of property value. Determines the currency value. Default value is |
init |
Initializes the control. |
setEmptyIndicatorMode |
Sets a new value for property emptyIndicatorMode. Specifies if an empty indicator should be displayed when there is no text. When called with a value of Default value is |
setStringValue |
Sets a new value for property stringValue. Determines the currency value as a string. String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the Note: If set, it will take precedence over the When called with a value of |
Creates a new subclass of class sap.ui.unified.Currency 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.core.Control.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 |
Gets current value of property currency.
Determines the displayed currency code (ISO 4217).
Note: If a * character is set instead of currency code, only the character itself will be rendered, ignoring the value
property.
Gets current value of property emptyIndicatorMode.
Specifies if an empty indicator should be displayed when there is no text.
Default value is Off
.
Gets current value of property maxPrecision.
Defines the space that is available for the precision of the various currencies.
Gets current value of property stringValue.
Determines the currency value as a string.
String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the stringValue
property to keep the number in decimal format.
Note: If set, it will take precedence over the value
property.
Gets current value of property useSymbol.
Displays the currency symbol instead of the ISO currency code.
Default value is true
.
Sets a new value for property emptyIndicatorMode.
Specifies if an empty indicator should be displayed when there is no text.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Off
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sEmptyIndicatorMode | sap.m.EmptyIndicatorMode | Off |
New value for property |
Sets a new value for property stringValue.
Determines the currency value as a string.
String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the stringValue
property to keep the number in decimal format.
Note: If set, it will take precedence over the value
property.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sStringValue | string |
New value for property |