object-table (v1) (deprecated)
object-table
v1 is considered deprecated
Support for object-table
v1 may be dropped in future versions of the JourneyApps Runtime. Please upgrade your app to use object-table
v3 to ensure that your app remains compatible with the JourneyApps Runtime.
Similar to object-list
, object-tables can be customized in 3 ways:
Non-Selectable
Selectable
Clickable
Initialization of Data in JavaScript
All object-tables use a Query or Array to determine what objects are displayed in it.
Non-Selectable Table
This table can be used for display purposes only and doesn't allow the user to select anything.
Selectable Table
This table allows the user to select one of the objects in it, which is then highlighted. The selected object is stored in a specified variable (specified using bind="
- see Configuration below).
A Selectable Table is typically used in conjunction with a button — The user selects an object in the table, and then clicks a button to take an action — for example call a JavaScript/TypeScript function which does something with the object that the user selected (referencing the variable in which the selected object is stored), or follow a link (passing the selected object as a parameter to the next view)
Since a Selectable Table allows the user to select an option, you need a variable in which to store the selected object, and then specify that variable at bind=""
in the object-table.
Clickable Table
This table allows the user to tap / "click" on a particular row/object, and a specified JavaScript/TypeScript function is then immediately called, and the object that the user selected is passed as an argument to the JavaScript/TypeScript function.
The JavaScript/TypeScript function that is called when the user taps on a row is typically used to follow a link to a next screen — Therefore, a Clickable Table is used for similar cases as a Selectable Table, but it provides a better user experience because it requires less scrolling and tapping by the user.
Note that a function call of your choosing is specified at on-press=""
, which you then need to define in the view's JavaScript/TypeScript. The object that the user selected can be passed as an argument to this JavaScript/TypeScript function (clickedItem
in the example below) by using the special $selection
variable.
The most common use case of a clickable table is to call a link when the user clicks on an item, and pass the clicked object as an argument to the link — which we show in this example below.
We can also call the link directly from the on-press
action:
The <action>
tag has the following configuration:
action icons whitelist removed
From version 4.27 of the JourneyApps Container, any Ionicon is allowed in icon
.
Pre-v4.27, only ion-chevron-right
, ion-more
, ion-edit
and ion-trash-a
were allowed.
Note on appearance
The appearance of a Clickable Table on a mobile device is currently the same as a Non-Selectable Table.
Configuration
Nested Tags — Columns
An object-table can contain any number of <column>
tags that represent the vertical columns in the table. Not to be confused with the columns
component used for tablet apps.
Each column contains a format string for the value of the column in each row — typically a field of the object.
A column may optionally have a heading
attribute. If at least one column has a heading
attribute, a header row will be added to the table with the headings of the columns.
Last updated