The Table Field is for displaying collections of data that might be displayed as a table.
In defining each column for display, there are specific attributes associated with the column itself and each individual cell within it. The fields for configuring a column include:
field: This attribute should align with the original column field name. It determines how the row values will be populated based on the provided column name.
label: If this attribute is provided, it will replace the original column name when rendering the column. This allows for custom labeling of the column.
For instance, consider the following example:
TextField(field='desc', label='Description', prefix=' * ')
This can be understood as:
TextField(field='COLUMN_ORIGINAL_NAME', label='COLUMN_NEW_NAME', prefix=' * ')
Here, "field" is the original column name, "label" is the new label to display, and "prefix" is an additional option specific to individual cells within the column.
Options like "prefix" apply only to the cells within the column and do not affect the column definition itself.
Property | Type | Description | Required | Default | Enum |
---|---|---|---|---|---|
type | string | The type of field. | No | table | table |
label | string/null | Label to show for this field. | No | null | |
css_style | object/null | Style to apply in the HTML of the UI. | No | null | |
css_class | string/null | CSS class to apply in the HTML component. | No | null | |
translate | string/null | Translation key for the field. | No | null | |
translate_label | string/null | Translation key for the label. | No | null | |
analytics | object/null | Analytics configuration. | No | null | |
if_not_exist | string/null | Show only if the specified field doesn't exist. | No | null | |
if_exist | string/null | Show only if the specified field does exist. | No | null | |
only_on_highlight | boolean | Show only when the value is highlighted. | No | false | |
display | any | Value from the field. | No | null | |
field | string | Path to field from which to retrieve the value (in JMESPath format). | Yes | ||
field_highlight | string/null | Path to highlight field from which to retrieve the value, in case it is not the same as the field parameter (in JMESPath format). | No | null | |
default | any | Default value to use in case no value was found for the field. | No | null | |
transform | array/string/null | List of transformations to apply to the displayed values. | No | null | |
suffix | string/null | Suffix to append to the value or values. | No | null | |
prefix | string/null | Prefix to append to the value or values. | No | null | |
suffix_label | string/null | Suffix to append to the label of the field. | No | null | |
prefix_label | string/null | Prefix to append to the label of the field. | No | null | |
sort | string/boolean | Sort order for values in an array. | No | false | asc, desc |
unique | boolean | If the values are in an array, remove the duplicates. | No | false | |
show_blank | boolean | If there is no value, or value is null, and show_blank is true, keep the field. | No | false | |
replacement | string/null | Replacement string for matches in the transformations Transformation.REPLACE_FIRST , Transformation.REPLACE_LAST , and Transformation.REPLACE_ALL . | No | null | |
pattern | string/null | Pattern used to look for matches in the transformations Transformation.REPLACE_FIRST , Transformation.REPLACE_LAST , and Transformation.REPLACE_ALL . | No | null | |
columns_exclude | array/string/null | Name of the columns to exclude from the response. | No | [] | |
columns_definition | array/object/null | Definitions of how to display the cells of the column. Each definition in this list will define the display of the cells and the label of the definition will be used as the new column title. | No | [] | |
columns_path | string | Path, from the root table, to the columns names. The result of this path should be a list of text. | Yes | ||
rows_path | string | Path, from the root table, to the row values. The result of this path should be an array with all the rows for the table. | Yes | ||
include_additional_cols | boolean/null | Toggles the additional_columns feature. If active, the table will be built using every column on columns_path except the excluded columns. If inactive, the table will be built using only the columns in columns_definition. | No | true |
{ "type": "table", "label": "Employee Data", "css_style": null, "css_class": null, "translate": null, "translate_label": null, "analytics": null, "if_not_exist": null, "if_exist": null, "only_on_highlight": false, "display": null, "field": "employee_table", "field_highlight": null, "default": null, "transform": null, "suffix": null, "prefix": null, "suffix_label": null, "prefix_label": null, "sort": false, "unique": false, "show_blank": false, "replacement": null, "pattern": null, "columns_exclude": [], "columns_definition": [], "columns_path": "columns", "rows_path": "rows", "include_additional_cols": true }
table_field_example = TableField( field="employee_table", columns_path="columns", rows_path="rows", include_additional_cols=True )