Shared Functions

This section describes functions available in components based on the Data Table component.

Remove Rows

Removes the rows from the data table specified by the indices provided in the Index argument.

Function name: removeRows

Arguments:

Field Name

Field Type

Field Description

Index

Data Table

Data table with a single String-type field Index. Each row specifies an index of a row to remove from the data table.

Add Row

Inserts the data table provided in the Row argument into the index position provided by the Index argument.

Function name: addRow

Arguments:

Field Name

Field Type

Field Description

Index

Integer

Row index indicating where the new row should be added.

Row

Data Table

Data table containing the data to insert into the data table. Format of the data table Row must be the same as the format of the data table where the row is being added.

Reorder Row

Moves one or more records within the Data Table component according to their Reorder Records' values.
Supports validation and reordering in nested data structures.

Function name: reorderRow

Arguments:

Field Name

Field Type

Field Description

Reorder Records

Data Table

A data table containing the records to move. The records may be UUIDs or values indicated by the Record ID Column Name

Reorder ID

String

Specifies the row before which the insertion is performed. May be a UUID or a value indicated by the Record ID Column Name. If null, the records are inserted at the end

Parent Value

String

Specifies the new parent row identifier if nested data is used. May be a UUID or a value indicated by the Parent Record ID Column Name. Can be null if no parent change is required

Update Cell

Update the cell specified by the Index and Field arguments with the value indicated by the Value argument.

Function name: updateCell

Arguments:

Field Name

Field Type

Field Description

Index

String

Row index of the cell to update.

Field

String

Field name of the cell to update.

Value

Data Table

Data table containing a single field value and a single row containing the value with which to update the cell.

The data type of the value field must be of a type that can be cast to the type of the cell being updated.

The following example illustrates one way of calling the updateCell function:

  • Consider a data table component named dataTableComponent0, with at least one existing row and a field exampleField.

  • We want to update the value of the cell in the first row of the field exampleField with the String “this is the new field value”

The expression is used in a binding within the dashboard context where dataTableComponent0 is located:

{form/dataTableEditorUpdateCell:updateCell("1","exampleField",'array("value", "This is the new field value")')}

The expression can be decomposed as follows:

  • form/dataTableComponent0 - The schema form/ indicates a dashboard component, and dataTableComponent0 indicates the specific component.

  • :updateCell Indicates the function updateCell is being called from the component

  • The function has the following arguments:

    • "1" - the row of the data table to update

    • "exampleField" - the field of the data table to update

    • 'array("value", "This is the new field value")' Creates the a data table with a single field value of String type, and a single row with the data "This is the new field value"

Select Row

Select or deselect a specific row in the data table based on the Record Index. The Record Index may be either the UUID of the row, or a value in the Data Table field indicated by the Record ID Column Name.

This function can also be used to select all rows, deselect all rows, or reverse the selection state of all rows in the data table.

Function name: selectRow

Arguments:

Field Name

Field Type

Field Description

Record Index

String

Indicates the row to be selected in the data table based on UUID or the value indicated as the row (record) ID by the Record ID Column Name.

Selection Type

Integer

Indicates the type of selection operation to be applied to the row or table. The following options are available:

  • 0 - Deselect the row indicated by the Record Index argument. The selection state of all other rows is unchanged.

  • 1 - Select the row indicated by the Record Index argument. The selection state of all other rows is unchanged.

  • 2 - Deselect all rows in the table, the Record Index argument is ignored.

  • 3 - Select all rows in the table, the Record Index argument is ignored.

  • 4 - Reverse the selection state of all rows in the table. All selected rows will be deselected, and all others will be selected. The Record Index argument is ignored.

Get Selected Rows

Returns a Data Table containing the Key of each selected row. If a field name is indicated by the property Record ID Column Name, the key will be the value of this field. If Record ID Column Name is not configured, key will be the row UUID.

Function name: getSelectedRows

Arguments:

None

Returns:

Field Name

Field Type

Field Description

Key

String

UUID of the selected rows.

Reorder Record

Moves one or more records within the Data Table Editor component according to their identifiers.
Supports reordering of flat and nested (tree-structured) data.

Function name: reorderRow

Arguments

Field Name

Field Type

Field Description

Record IDs

Data Table

A data table containing the identifiers of the records to be moved. The identifiers may be UUIDs or values referenced by the Record ID Column Name.

Reorder ID

String

Specifies the target record before which the moved records will be inserted. May be a UUID or a value referenced by the Record ID Column Name. If null, the records are inserted at the end of the list.

Parent Value

String

Specifies the parent record value when working with hierarchical (nested) data. The value must correspond to the value stored in the Parent ID Column of the Data Table. If null, the parent is not changed.

Validation Field

String

(Optional) Name of a field used to validate uniqueness during reordering. If another record already has the same value in this field, the operation is rejected and a warning is displayed.

Parent Value

The hierarchical reordering is performed using the Parent Value parameter.

The Parent Value represents the actual value stored in the column designated as the Parent ID Column in the Data Table Editor configuration. This approach ensures consistent behavior when working with nested data structures and eliminates ambiguity between record identifiers and parent reference values.

If Parent Value is not specified (null), the record hierarchy remains unchanged and only the order of records within the current level is affected.

Reset

When the reset() function of a data table is called, all selected rows are returned to their initial state. This means any user-entered values are discarded and replaced with the original values. Any filtering or sorting applied to the table by the user is returned to its default state.

Function name: reset

Arguments:

None

Returns:

None

Was this page helpful?