RealGridLocale
Set the locale and currency for the grid to refer to.
numberFormats: Register numberFormat using Intl.NumberFormat (opens in a new tab) .
messages: Change the messages in the grid to suit the user environment.
Signature:
export interface RealGridLocale
Remarks
To display currency, currency
must be specified.
Properties
Property | Type | Description |
---|---|---|
currency | string | Specify the currency code to use |
locale | string | Specify by language or language-region type. |
messages | RealGridMessages | Specifies the message displayed in the grid. |
numberFormats | { [name: string]: NumberFormatOptions; } | Register the numberFormat to be used in the column. The thousand separator and decimal point symbol change depending on the locale. |
Properties Desc
currency
Specify the currency code to use
Type
- string
Remarks:
Designated as KRW
, USD
, etc.
locale
Specify it as a language or language-region type.
Type
- string
messages
Specifies the message displayed in the grid.
Type
- RealGridMessages
numberFormats
Register the numberFormat to be used in the column. The thousand separator and decimal point symbol change depending on the locale.
Type
- { [name: string]: NumberFormatOptions; }
Remarks:
Use Intl.NumberFormat (opens in a new tab) to create a string to be displayed on the screen.
Example:
RealGrid.setLocale({
locale: "ko",
currency: "KRW",
numberFormats: {
"number2": { // `number2` is set as the numberFormat of the column.
style: "decimal", // number format
minimumFractionDigits: 2, // Output to at least 2 decimal places. default: 0
maximumFractionDigits: 2, // Print up to 2 decimal places. default: 3
excelFormat: "_-#,##0.0?_ ;-#,##0.0?_ " // Format used when output to Excel
},
"USD": {
style: "currency", // Currency format automatically attaches a currency symbol according to the specified currency.
currency: "USD", // currency unit
excelFormat: '"US$"#,##0.00' // Format used when output to Excel
}
}
});
const columns = [
{ name: "importPrice", fieldName: "importPrice", numberFormat: "USD"}
]