Search.../

onRowSelect( )

Adds an event handler that runs when a table row is selected.

Description

A table receives a TableRowEvent when the table is set in the Editor to select rows when clicked. Clicking Selects Rows

Syntax

function onRowSelect(eventHandler: TableRowEventHandler): Table
eventHandler: function TableRowEventHandler(event: TableRowEvent): void

onRowSelect Parameters

NAME
TYPE
DESCRIPTION
eventHandler

The name of the function or the function expression to run when the row is selected.

Returns

The table that triggered the event.

Return Type:

TableRowEventHandler Parameters

NAME
TYPE
DESCRIPTION
event

The event that has occurred.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Get the selected table cell information

Copy Code
1$w("#myTable").onRowSelect( (event) => {
2 let rowData = event.rowData; // {"fName": "John", "lName": "Doe"}
3 let rowIndex = event.rowIndex; // 2
4} );
Get the full item information from the dataset

Copy Code
1$w("#myTable").onRowSelect( (event) => {
2 let rowData = event.rowData;
3} );
4
5// ...
6
7$w("#myDataset").onCurrentIndexChanged( (event) => {
8 let itemData = $w("#myDataset").getCurrentItem();
9} );
10
11/* rowData:
12 * {
13 * "fName": "John",
14 * "lName": "Doe"
15 * }
16 *
17 * itemData:
18 * {
19 * "_id": "e6895a76-3a89-4aa7-8f6a-023061cd8c24",
20 * "_owner": "fdkr99hk-gh94-f8i4-cd8e-so4309dsk3f3",
21 * "_createdDate": "2017-03-16T09:08:41.826Z",
22 * "_updatedDate": "2017-03-16T09:08:58.476Z",
23 * "fName": "John",
24 * "lName": "Doe"
25 * }
26 */