...
Notice for example that the valueType for agreementStatus is "String", whereas later on the same path is described as an "Enum". We will look more at the filters later, but for right now all you need to know is that a valueType String means that the resulting field will be displayed as simple text in the resulting table.
Likewise we use "Boolean" and "Date" types to drive display of either a FormattedUTCDate, or a tick/cross for true/false.
These columns are then used to populate a component which allows us to pick one or several of these to form the columns for our display table in the output. The label will be the default label displayed for that column, although this can be overwritten.
Filters
This section drives both how we dynamically create the filter sections as well as how we build the filter part of the final query. As mentioned above lets look first at the agreementStatus entry:
Code Block |
---|
{
"name":"agreementStatus",
"label": "Agreement status",
"filterPath":"agreementStatus.value",
"valueType": "Enum",
"enumValues": [
{"value": "active", "label": "Active"},
{"value": "closed", "label": "Closed"},
{"value": "in_negotiation", "label": "In negotiation"}
],
"comparators": ["==", "!="]
} |
As before we have a name and label, used to help the user while they build their widget configuration in the form. Here we have specified that the agreement status has type "Enum". This is because agreementStatus is not a string, but actually a closed list of possible values. This setup will mean that the user will see a dropdown list of the specified values.
Note |
---|
At some point we may offer a more complicated WidgetType (or version of SimpleSearch) that can look these values up at the point where the user is building their widget. |
Since we're just saving this to a JSON string eventually it wouldn't break anything to specify this as a "String" type. However that would necessitate that your users know each of the possible values for this field, as well as any differences between the filterĀ value and how it's displayed to them usually. In fact it wouldn't break anything to put type Date, but it would then render a datePicker component and return strings of form "2021-03-19", so wouldn't liekly be so useful.