|
1 | | -# FormatString [](https://docs.mendix.com/community/app-store/app-store-content-support) |
2 | | - |
3 | | -This widget adds a user-defined string to your page, taking object attributes as input parameters. |
4 | | - |
5 | | -## Contributing |
6 | | -For more information on contributing to this repository visit [Contributing to a GitHub repository] (https://docs.mendix.com/howto/collaboration-project-management/contribute-to-a-github-repository) |
7 | | - |
8 | | -## Typical usage scenario |
9 | | - |
10 | | -Displaying multiple attributes as a single string |
11 | | - |
12 | | -## Installation |
13 | | - |
14 | | -Import the widget to your project and add the Format String to a dataview on a page. Configure the properties to determine how the widget will behave in your application. |
15 | | - |
16 | | -## Features and limitations |
17 | | - |
18 | | -- Supports multiple attributes |
19 | | -- Attributes can be retrieved one-deep |
20 | | -- Setting the same attribute multiple times using different date/time formatting is not supported. |
21 | | - |
22 | | -## Properties |
23 | | - |
24 | | -### Data source |
25 | | - |
26 | | -The Data Source is used to add replacements for your **Display string**. The values from the attributes will be used to replace placeholders. See below for an example. |
27 | | - |
28 | | -| Property | Description | |
29 | | -| --- | --- | |
30 | | -| Variable name | Identifies the attribute value, this name should be used in 'Display string' property. | |
31 | | -| Attribute | Value of this attribute will be used to replace ${your_Variable_Name}, defined in 'Display string' property | |
32 | | -| Empty value replacement | This string will be used when an attribute returns empty. Note that this string is interpreted as HTML. | |
33 | | -| Date format | Shows date and/or time according to locale of user. Relative is time relative to current datetime. (E.g. 3 hours from now) | |
34 | | -| Date pattern | Optional, date pattern to override date part according to dojo/date/locale. See [Dojo documentation](https://dojotoolkit.org/reference-guide/1.10/dojo/date/locale/format.html#attributes) | |
35 | | -| Time pattern | Optional, time pattern to override time part according to dojo/date/locale. See [Dojo documentation](https://dojotoolkit.org/reference-guide/1.10/dojo/date/locale/format.html#attributes) | |
36 | | -| Render value as HTML | Escapes string value when set to false | |
37 | | -| Decimal precision | Amount of decimals | |
38 | | -| Group digits | Displays a numeric value with group digits | |
39 | | - |
40 | | -### Behavior |
41 | | - |
42 | | -| Property | Description | |
43 | | -| --- | --- | |
44 | | -| On click | Microflow to be invoked on click. | |
45 | | -| Stop propagation | Stop handling click action, prevent click event to go to other components. This can be useful when you don't want other actions (like selection in a listview) to happen | |
46 | | -| Display string | This string is the heart of the FormatString. It will be used as a template for the content. Use `${your_Variable_Name}` to have the attribute value inserted in this string. Note that this string, except for the replacements, is interpreted as HTML. | |
47 | | -| Class string | Use `${your_Variable_Name}` to have the attribute value used in the className of the widget. See 'Display string'. If you want to use multiple classes, make sure you separate them with spaces. | |
48 | | -| Translatable strings | Use translatable strings (instead of internal language pack) | |
49 | | -| Locale selection | When you use the internal language pack, only a few languages are supported. Choose 'automatic' to let Dojo choose based on the application (with a fallback to 'en-us') | |
50 | | - |
51 | | -### Customization |
52 | | - |
53 | | -These are the values that you can change when you use 'Translatable Strings'. Note that the widget has default values for 'nl-nl', 'en-us' and 'en-gb'. |
54 | | - |
55 | | -* String value for second |
56 | | -* String value for seconds |
57 | | -* String value for minute |
58 | | -* String value for minutes |
59 | | -* String value for hour |
60 | | -* String value for hours |
61 | | -* String value for day |
62 | | -* String value for days |
63 | | -* String value for week |
64 | | -* String value for weeks |
65 | | -* String value for month |
66 | | -* String value for months |
67 | | -* String value for year |
68 | | -* String value for years |
69 | | -* String value for from now |
70 | | -* String value for ago |
71 | | - |
72 | | -## Example usage |
73 | | - |
74 | | -* Let's say you have an attribute that contains a hyperlink to a website (eg `http://mendix.com`). The attribute is called `Link` |
75 | | -* You want to show a link, it has to be a plain link. A simple HTML link |
76 | | - |
77 | | -Here is how you do that: |
78 | | - |
79 | | -* Add an attribute at 'Data Source'. Select the attribute `Link` |
80 | | -* Set the variable name to `LinkVariable` |
81 | | -* In **Behavior** is set the **Display string** to: |
82 | | - |
83 | | -```html |
84 | | - <a href="${LinkVariable}" target="_blank">Link Text</a> |
85 | | -``` |
86 | | - |
87 | | -This is a simple explanation of usage. |
| 1 | +Please see [Format String](https://docs.mendix.com/appstore/widgets/format-string) in the Mendix documentation for details. |
0 commit comments