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:

  1. 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.

  2. 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.


Schema Details

PropertyTypeDescriptionRequiredDefaultEnum
typestringThe type of field.Notabletable
labelstring/nullLabel to show for this field.Nonull
css_styleobject/nullStyle to apply in the HTML of the UI.Nonull
css_classstring/nullCSS class to apply in the HTML component.Nonull
translatestring/nullTranslation key for the field.Nonull
translate_labelstring/nullTranslation key for the label.Nonull
analyticsobject/nullAnalytics configuration.Nonull
if_not_existstring/nullShow only if the specified field doesn't exist.Nonull
if_existstring/nullShow only if the specified field does exist.Nonull
only_on_highlightbooleanShow only when the value is highlighted.Nofalse
displayanyValue from the field.Nonull
fieldstringPath to field from which to retrieve the value (in JMESPath format).Yes

field_highlightstring/nullPath to highlight field from which to retrieve the value, in case it is not the same as the field parameter (in JMESPath format).Nonull
defaultanyDefault value to use in case no value was found for the field.Nonull
transformarray/string/nullList of transformations to apply to the displayed values.Nonull
suffixstring/nullSuffix to append to the value or values.Nonull
prefixstring/nullPrefix to append to the value or values.Nonull
suffix_labelstring/nullSuffix to append to the label of the field.Nonull
prefix_labelstring/nullPrefix to append to the label of the field.Nonull
sortstring/booleanSort order for values in an array.Nofalseasc, desc
uniquebooleanIf the values are in an array, remove the duplicates.Nofalse
show_blankbooleanIf there is no value, or value is null, and show_blank is true, keep the field.Nofalse
replacementstring/nullReplacement string for matches in the transformations Transformation.REPLACE_FIRST, Transformation.REPLACE_LAST, and Transformation.REPLACE_ALL.Nonull
patternstring/nullPattern used to look for matches in the transformations Transformation.REPLACE_FIRST, Transformation.REPLACE_LAST, and Transformation.REPLACE_ALL.Nonull
columns_excludearray/string/nullName of the columns to exclude from the response.No[]
columns_definitionarray/object/nullDefinitions 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_pathstringPath, from the root table, to the columns names. The result of this path should be a list of text.Yes

rows_pathstringPath, 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_colsboolean/nullToggles 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.Notrue

Example JSON Representation

{
  "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
}

Code Example of Usage

table_field_example = TableField(
    field="employee_table",
    columns_path="columns",
    rows_path="rows",
    include_additional_cols=True
)

  • No labels