You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
@@ -28,55 +27,56 @@ A good example of a `Formatter` could be a column name `isActive` which is a `bo
28
27
29
28
**List of provided `Formatters`**
30
29
31
-
*`arrayObjectToCsv`: Takes an array of complex objects converts it to a comma delimited string.
32
-
*`arrayToCsv` : takes an array of text and returns it as CSV string
33
-
*`checkmarkMaterial` use Material Design to display a checkmark icon
34
-
*`collection`: Looks up values from the columnDefinition.params.collection property and displays the label in CSV or string format
35
-
*`complexObject`: takes a complex object (with a `field` that has a `.` notation) and pull correct value, there are multiple ways to use it
30
+
*`Formatters.arrayObjectToCsv`: Takes an array of complex objects and converts it to a comma delimited string.
31
+
* you also need to pass the property name(s) for the complex object, i.e.: `formatter: Formatters.arrayObjectToCsv, params: { propertyNames: ['name'], useFormatterOuputToFilter: true }`
32
+
*`Formatters.arrayToCsv` : takes an array of text and returns it as CSV string
33
+
*`Formatters.checkmarkMaterial` use Material Design to display a checkmark icon
34
+
*`Formatters.collection`: Looks up values from the columnDefinition.params.collection property and displays the label in CSV or string format
35
+
*`Formatters.complexObject`: takes a complex object (with a `field` that has a `.` notation) and pull correct value, there are multiple ways to use it
36
36
1.`{ id: 'firstName', field: 'user.firstName', formatter: Formatters.complexObject}`, will display the user's first name
*`currency`: will help with currency other than dollar (ie `€`), there are multiple `params` available for this formatter
39
+
*`Formatters.currency`: will help with currency other than dollar (ie `€`), there are multiple `params` available for this formatter
40
40
*`currencyPrefix`, `currencySuffix`, `minDecimal`, `maxDecimal`, `numberPrefix`, `numberSuffix`, `decimalSeparator`, `thousandSeparator` and `displayNegativeNumberWithParentheses`
41
41
* the distinction between `numberPrefix` and `currencyPrefix` can be seen when using `displayNegativeNumberWithParentheses`, for example if we have a value of `-12.432` with the `Formatters.currency` and `params: { currencyPrefix: '€', numberPrefix: 'Price ', numberSuffix: 'EUR' }` the output will be `"Price (€12.432) EUR"`
42
-
*`dateEuro`: Takes a Date object and displays it as an Euro Date format (DD/MM/YYYY)
43
-
*`dateTimeEuro`: Takes a Date object and displays it as an Euro Date+Time format (DD/MM/YYYY HH:mm:ss)
44
-
*`dateTimeShortEuro`: Takes a Date object and displays it as an Euro Date+Time (without seconds) format (DD/MM/YYYY HH:mm)
45
-
*`dateTimeEuroAmPm`: Takes a Date object and displays it as an Euro Date+Time+(am/pm) format (DD/MM/YYYY hh:mm:ss a)
46
-
*`dateIso` : Takes a Date object and displays it as an ISO Date format (YYYY-MM-DD)
47
-
*`dateTimeIso` : Takes a Date object and displays it as an ISO Date+Time format (YYYY-MM-DD HH:mm:ss)
48
-
*`dateTimeIsoAmPm` : Takes a Date object and displays it as an ISO Date+Time+(am/pm) format (YYYY-MM-DD h:mm:ss a)
49
-
*`dateTimeShortIso`: Takes a Date object and displays it as an ISO Date+Time (without seconds) format (YYYY-MM-DD HH:mm)
50
-
*`dateUs` : Takes a Date object and displays it as an US Date format (MM/DD/YYYY)
51
-
*`dateTimeUs` : Takes a Date object and displays it as an US Date+Time format (MM/DD/YYYY HH:mm:ss)
52
-
*`dateTimeShortUs`: Takes a Date object and displays it as an US Date+Time (without seconds) format (MM/DD/YYYY HH:mm:ss)
53
-
*`dateTimeUsAmPm` : Takes a Date object and displays it as an US Date+Time+(am/pm) format (MM/DD/YYYY hh:mm:ss a)
54
-
*`dateUtc` : Takes a Date object and displays it as a TZ format (YYYY-MM-DDThh:mm:ssZ)
55
-
*`decimal`: Display the value as x decimals formatted, defaults to 2 decimals. You can pass "minDecimal" and/or "maxDecimal" to the "params" property.
56
-
*`dollar`: Display the value as 2 decimals formatted with dollar sign '$' at the end of of the value.
57
-
*`dollarColored`: Display the value as 2 decimals formatted with dollar sign '$' at the end of of the value, change color of text to red/green on negative/positive value
58
-
*`dollarColoredBoldFormatter`: Display the value as 2 decimals formatted with dollar sign '$' at the end of of the value, change color of text to red/green on negative/positive value, show it in bold font weight as well
59
-
*`hyperlink`: takes a URL cell value and wraps it into a clickable hyperlink `<a href="value">value</a>`
42
+
*`Formatters.dateEuro`: Takes a Date object and displays it as an Euro Date format (DD/MM/YYYY)
43
+
*`Formatters.dateTimeEuro`: Takes a Date object and displays it as an Euro Date+Time format (DD/MM/YYYY HH:mm:ss)
44
+
*`Formatters.dateTimeShortEuro`: Takes a Date object and displays it as an Euro Date+Time (without seconds) format (DD/MM/YYYY HH:mm)
45
+
*`Formatters.dateTimeEuroAmPm`: Takes a Date object and displays it as an Euro Date+Time+(am/pm) format (DD/MM/YYYY hh:mm:ss a)
46
+
*`Formatters.dateIso` : Takes a Date object and displays it as an ISO Date format (YYYY-MM-DD)
47
+
*`Formatters.dateTimeIso` : Takes a Date object and displays it as an ISO Date+Time format (YYYY-MM-DD HH:mm:ss)
48
+
*`Formatters.dateTimeIsoAmPm` : Takes a Date object and displays it as an ISO Date+Time+(am/pm) format (YYYY-MM-DD h:mm:ss a)
49
+
*`Formatters.dateTimeShortIso`: Takes a Date object and displays it as an ISO Date+Time (without seconds) format (YYYY-MM-DD HH:mm)
50
+
*`Formatters.dateUs` : Takes a Date object and displays it as an US Date format (MM/DD/YYYY)
51
+
*`Formatters.dateTimeUs` : Takes a Date object and displays it as an US Date+Time format (MM/DD/YYYY HH:mm:ss)
52
+
*`Formatters.dateTimeShortUs`: Takes a Date object and displays it as an US Date+Time (without seconds) format (MM/DD/YYYY HH:mm:ss)
53
+
*`Formatters.dateTimeUsAmPm` : Takes a Date object and displays it as an US Date+Time+(am/pm) format (MM/DD/YYYY hh:mm:ss a)
54
+
*`Formatters.dateUtc` : Takes a Date object and displays it as a TZ format (YYYY-MM-DDThh:mm:ssZ)
55
+
*`Formatters.decimal`: Display the value as x decimals formatted, defaults to 2 decimals. You can pass "minDecimal" and/or "maxDecimal" to the "params" property.
56
+
*`Formatters.dollar`: Display the value as 2 decimals formatted with dollar sign '$' at the end of of the value.
57
+
*`Formatters.dollarColored`: Display the value as 2 decimals formatted with dollar sign '$' at the end of of the value, change color of text to red/green on negative/positive value
58
+
*`Formatters.dollarColoredBoldFormatter`: Display the value as 2 decimals formatted with dollar sign '$' at the end of of the value, change color of text to red/green on negative/positive value, show it in bold font weight as well
59
+
*`Formatters.hyperlink`: takes a URL cell value and wraps it into a clickable hyperlink `<a href="value">value</a>`
60
60
* the cell value **must contain** (`ftp://abc`, `http://abc` or `https://abc`), if it doesn't then use `fakeHyperlink`
61
-
*`hyperlinkUriPrefix`: format a URI prefix into an hyperlink
62
-
*`icon`: to display an icon with defined CSS class name, use `params` to pass a `cssClass` property
63
-
*`iconBoolean`: similar to `icon` but will only be displayed on a Boolean truthy value, use `params` to pass a `cssClass` property
64
-
*`mask`: to change the string output using a mask, use `params` to pass a `mask` property
61
+
*`Formatters.hyperlinkUriPrefix`: format a URI prefix into an hyperlink
62
+
*`Formatters.icon`: to display an icon with defined CSS class name, use `params` to pass a `cssClass` property
63
+
*`Formatters.iconBoolean`: similar to `icon` but will only be displayed on a Boolean truthy value, use `params` to pass a `cssClass` property
64
+
*`Formatters.mask`: to change the string output using a mask, use `params` to pass a `mask` property
*`percent`: Takes a cell value number (between 0.0-1.0) and displays a red (<50) or green (>=50) bar
69
-
*`percentComplete` : takes a percentage value (0-100%), displays a bar following this logic:
68
+
*`Formatters.percent`: Takes a cell value number (between 0.0-1.0) and displays a red (<50) or green (>=50) bar
69
+
*`Formatters.percentComplete` : takes a percentage value (0-100%), displays a bar following this logic:
70
70
*`red`: < 30%, `grey`: < 70%, `green`: >= 70%
71
-
*`percentCompleteBar` : same as `percentComplete` but uses [Bootstrap - Progress Bar with label](https://getbootstrap.com/docs/3.3/components/#progress-label).
72
-
*`percentCompleteBarWithText`: Takes a cell value number (between 0-100) and displays SlickGrid custom "percent-complete-bar" with Text a red (<30), silver (>30 & <70) or green (>=70) bar
73
-
*`percentSymbol`: Takes a cell value number (between 0-100) and add the "%" after the number
74
-
*`progressBar`: Takes a cell value number (between 0-100) and displays Bootstrap "progress-bar" a red (<30), silver (>30 & <70) or green (>=70) bar
75
-
*`translate`: Takes a cell value and translates it (i18n). Requires an instance of the Translate Service:: \`i18n: this.translate
76
-
*`translateBoolean`: Takes a boolean value, cast it to upperCase string and finally translates it (i18n).
77
-
*`tree`: Formatter that must be used when the column is a Tree Data column
78
-
79
-
> **Note:** The list is certainly not up to date (especially for Dates), please refer to the [Formatters export](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/formatters/index.ts#L37) to know exactly which formatters are available.
71
+
*`Formatters.percentCompleteBar` : same as `percentComplete` but uses [Bootstrap - Progress Bar with label](https://getbootstrap.com/docs/3.3/components/#progress-label).
72
+
*`Formatters.percentCompleteBarWithText`: Takes a cell value number (between 0-100) and displays SlickGrid custom "percent-complete-bar" with Text a red (<30), silver (>30 & <70) or green (>=70) bar
73
+
*`Formatters.percentSymbol`: Takes a cell value number (between 0-100) and add the "%" after the number
74
+
*`Formatters.progressBar`: Takes a cell value number (between 0-100) and displays Bootstrap "progress-bar" a red (<30), silver (>30 & <70) or green (>=70) bar
75
+
*`Formatters.translate`: Takes a cell value and translates it (i18n). Requires an instance of the Translate Service:: \`i18n: translate
76
+
*`Formatters.translateBoolean`: Takes a boolean value, cast it to upperCase string and finally translates it (i18n).
77
+
*`Formatters.tree`: Formatter that must be used when the column is a Tree Data column
78
+
79
+
> **Note:** The list might not be up to date (especially for Dates), please refer to the [Formatters export](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/formatters/index.ts#L37) to know exactly which formatters are available.
80
80
81
81
> **Note** all Date formatters are formatted using [Tempo](https://tempo.formkit.com/#format-tokens). There are also many more Date formats not shown above, simply visit the [formatters.index](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/formatters/formatters.index.ts#L101) to see all available Date/Time formats.
0 commit comments