jig.table

The table jig displays structured data in rows and columns, allowing users to view and interact with multiple records within the app.

Table jig
Table jig

Configuration options

Some properties are common to all jig types, see Common jig type properties for a list and their configuration options.

The table Jigx type includes multiple child components, each of which can be configured individually based on the desired table layout. The properties for each component are described below.

component.table-row

component.table-row- The table jig is configured with a datasource, and a single component.table-row is configured and iterates through the datasource to display each row. This is a required component.

Structure

component.table-row

This is similar in configuration to a where a single table-row is configured and iterates through the datasource.

  • instanceId - Unique identifier of the table-row component. When defined its possible to address its state. InstanceId: Expects a string.

  • when - used to determine under which conditions the table will display. If the property is set to false, the component won't be displayed. Default is true. An expression can be configured in this property.

color

Highlight the row(s) with a distinct background color for emphasis or status. For example, color: - when: [email protected] > 60 color: warning

data

Reference the defined datasource to use in the component.table-row.

datasources

Configure a datasource to call the data to display in the table rows.

onPress

Action that will be triggered by pressing on the table row.

component.table-cell

This component is part of the columnDefinition setup, allowing reusable configurations for customizing column cells and ensuring consistent, flexible table layouts.

structure

children

Define the cell value by using a , or component.text. Specify a value for the cell, this can be text that can be evaluated, translated, and formatted.

onPress

Action that will be triggered by pressing on the table cell for a specific column.

component.table-header-cell

This component is part of the columnDefinition setup, allowing reusable configurations for column header cells and ensuring consistent, flexible table layouts.This component targets the cells in the columns' header.

Structure

children

Define the cell value by using a or by using a component.text. Specify a value for the cell, this can be text that can be evaluated, translated, and formatted.

onPress

Action that will be triggered by pressing on the text in the table header's cell for a specific column.

This component is part of the columnDefinition setup, allowing reusable configurations for column footer cells and ensuring consistent, flexible table layouts.This component targets the cells in the columns' footer.

Structure

children

Define the cell value by using a , or by using component.text. Specify a value for the cell, this can be text that can be evaluated, translated, formatted.

onPress

Action that will be triggered by pressing on the text in the table footer's cell for a specific column.

  • This component targets the entire table footer. All configured properties will be applied uniformly to it.

  • This property works in conjunction with the component.table-footer-cell. When a component.table-footer-cell is defined within the columnDefinition, ensure that the component.table-footer property is also included to enable the footer component to render. See the YAML example below.

Structure

color

Add a distinct background color for emphasis or status to the table footer. For example, color: - when: true color: color4

component.table-header

  • This component targets the entire table header. All configured properties will be applied uniformly to it.

  • Specifying the component without additional properties will render the header columns using the column.id as the header text.

columns

Other options

columns

Defines the structure and configuration for a single table column, either through inline definitions or by referencing a reusable column definition. Columns can also be dynamically set using a single expression for flexible configuration across all columns.

  • id:Specifies a unique identifier for the column, used to reference the column’s data. The name must be the same as the datasource column name for the data to display.

  • columnDefinition- a reusable configuration for a column, providing consistency across multiple columns. A columnDefinitionId: is required as an identifier of the column definition to be used.

columnDefinition

Defines reusable configurations for table columns, including properties like width, header, footer, and cell customization, allowing for flexible and consistent table layouts.

selectionToolbar

The selectionToolbar appears at the bottom of the table when rows are selected. To enable row selection, isSelectable: true must be set at the root level of the jig. The toolbar displays a tag with the number of selected rows, followed by the configured action. Avoid overloading the selectionToolbar with too many actions or long labels, as it may compress, break layout, or disappear if space runs out.

tableHeader

Define the appearance and behavior of all table headers, including color or onPress actions.

tableFooter

Define the appearance and behavior of all table footers, including color or onPress actions.

toolbar

The toolbar appears at the top of the table as a buttons. The toolbar is configured with actions, such as got-to or execute-entity to create a new row.

sort

Initial sort configuration for the table.

  • columnId - Provide the column name that the sorting will be applied to.

  • isDescending - set to true sorts descending, set to false sorts ascending. [email protected] is used to access the sort state within the jig. To add sorting to a table the jig.table must be configured with the following: 1) isSortable: true at the root level. 2) The data property must be set with an expression to sort the data in the columns. See data-yaml code example below. 3) The sort property configured at the root level to configure descending or ascending. See sort-yaml code example below.

State Configuration
Key
Notes

sort

Used to access the sorting state in the table.

Considerations

  • There is no horizontal scroll. Depending on the device, some columns may not be visible. For the best experience when viewing tables with many columns in the app, we recommend using a tablet.

  • To enable sorting in a table, set isSortable: true at the root level. The data property must include an expression for sorting and lookup, and the sort: isDescending property must be set to either false for ascending or true for descending.

  • To enable row selection, isSelectable: true must be set at the root level of the jig. The selectableToolbar becomes visible only when rows are selected and appears at the bottom of the table. It displays a tag showing the number of selected rows, followed by the configured action.

  • Avoid overloading the selectionToolbar with too many actions or long labels, as it may compress, break layout, or disappear if space runs out.

Examples and code snippets

Basic table with color

Basic table with color
Basic table with color

This example demonstrates a basic jig.table configuration using a static datasource to display construction project data. Row colors are dynamically set using a when condition based on the project's status ("Complete" or "Delayed").

Example: See the full code example in GitHub.

This table example displays a week's shifts per technician using a jig.table with Dynamic Data. The table is set up with a colored header and footer, and sorting is configured in descending order on the Technician Name column.

Example: See the full code example in GitHub.

Table with colored header & footer
Table with colored header & footer

Note: To add sorting to a table the jig.table must be configured with the following:

  1. isSortable: true at the root level.

  2. The data property must be set with an expression to sort the data in the columns.

  3. The sort property configured at the root level to configure descending or ascending.

Table widths & column definitions
Table widths & column definitions

In this example, a table summarizes the sale of products for the month. In the columnDefinition, the width, footer, and cell:format is configured. The tableHeader and tableFooter's appearance is enhanced by adding a color.

Example: See the full code example in GitHub.

Edit table rows using onPress

Editing the table
Editing the table

In this example, a table displays delivery items and their current status. The status column is editable to reflect delivery progress. The component.table-row is configured with an onPress event that triggers a go-to action. This action uses isModal: true to open a jig as a bottom modal. Inputs are passed to this jig, including the row’s id and status.

The modal jig includes a form component with a text-field that displays the initialValue using the status passed from the onPress event. An execute-entity action is used to update the status, and a goBack: previous closes the modal, returning to the table with the updated status shown.

Example: See the full code example in GitHub.

Delete selected rows (selectableToolbar)

This example demonstrates how to delete rows from a table. The isSelectable: true property is set at the root level of the jig, allowing rows to be selected. The selectableToolbar is configured to execute an action that deletes the selected data from the datasource, which also removes it from the table.

Note: The selectableToolbar only appears when rows are selected. Avoid overloading the selectionToolbar with too many actions or long labels, as it may compress, break layout, or disappear if space runs out.

Example: See the full code example in GitHub.

Delete rows in table
Delete rows in table

Add a new row (toolbar)

Add row to table
Add row to table

In this example, a table displays recorded sales. An action button in the top toolbar allows users to add a new row to the table. Tapping the button opens a jig as a bottom modal using isModal: true. The modal contains a component.form and an execute-entity action to create the new row. Once submitted, the goBack: previous property closes the modal, and the table updates to show the newly added row at the bottom.

Example: See the full code example in GitHub.

Last updated

Was this helpful?