$w.TableCellEvent

$w.TableCellEvent

Event that is fired when a table cell is selected.

This event is only fired if the table is set in the Editor to select cells when clicked. Clicking Selects Cells

Mixes In

$w.Event

Contents

cellColumnId Gets the column ID of the selected cell.
cellData Gets the data from the selected cell.
cellRowIndex Gets the row index of the selected cell.
context Gets the context of the event on a repeated element.
target Gets the element that the event was fired on.
type Gets the type of event that was fired.
cellColumnId

cellColumnId

Gets the column ID of the selected cell.

Syntax

get cellColumnId(): string

Description

The cellColumnId is the id property of the Column object that corresponds to the column of the selected cell.

Type

String

Examples

Get the selected table cell information

JHcoIiNteVRhYmxlIikub25DZWxsU2VsZWN0KCAoZXZlbnQsICR3KSA9PiB7CiAgbGV0IGNlbGxDb2xJZCA9IGV2ZW50LmNlbGxDb2x1bW5JZDsgICAgIC8vICJjb2x1bW5JZF9iMmIzLTg3ZDktNDkyNTAiCiAgbGV0IGNlbGxEYXRhID0gZXZlbnQuY2VsbERhdGE7ICAgICAgICAgIC8vICJKb2huIgogIGxldCBjZWxsUm93SW5kZXggPSBldmVudC5jZWxsUm93SW5kZXg7ICAvLyAxCn0gKTsK
$w("#myTable").onCellSelect( (event, $w) => {
  let cellColId = event.cellColumnId;     // "columnId_b2b3-87d9-49250"
  let cellData = event.cellData;          // "John"
  let cellRowIndex = event.cellRowIndex;  // 1
} );
cellData

cellData

Gets the data from the selected cell.

Syntax

get cellData(): string

Type

String

Examples

Get the selected table cell information

JHcoIiNteVRhYmxlIikub25DZWxsU2VsZWN0KCAoZXZlbnQsICR3KSA9PiB7CiAgbGV0IGNlbGxDb2xJZCA9IGV2ZW50LmNlbGxDb2x1bW5JZDsgICAgIC8vICJjb2x1bW5JZF9iMmIzLTg3ZDktNDkyNTAiCiAgbGV0IGNlbGxEYXRhID0gZXZlbnQuY2VsbERhdGE7ICAgICAgICAgIC8vICJKb2huIgogIGxldCBjZWxsUm93SW5kZXggPSBldmVudC5jZWxsUm93SW5kZXg7ICAvLyAxCn0gKTsK
$w("#myTable").onCellSelect( (event, $w) => {
  let cellColId = event.cellColumnId;     // "columnId_b2b3-87d9-49250"
  let cellData = event.cellData;          // "John"
  let cellRowIndex = event.cellRowIndex;  // 1
} );
cellRowIndex

cellRowIndex

Gets the row index of the selected cell.

Syntax

get cellRowIndex(): Number

Description

The rows in a table are zero-based and do not include the table header. Table Row Numbering

Type

Number

Examples

Get the selected table cell information

JHcoIiNteVRhYmxlIikub25DZWxsU2VsZWN0KCAoZXZlbnQsICR3KSA9PiB7CiAgbGV0IGNlbGxDb2xJZCA9IGV2ZW50LmNlbGxDb2x1bW5JZDsgICAgIC8vICJjb2x1bW5JZF9iMmIzLTg3ZDktNDkyNTAiCiAgbGV0IGNlbGxEYXRhID0gZXZlbnQuY2VsbERhdGE7ICAgICAgICAgIC8vICJKb2huIgogIGxldCBjZWxsUm93SW5kZXggPSBldmVudC5jZWxsUm93SW5kZXg7ICAvLyAxCn0gKTsK
$w("#myTable").onCellSelect( (event, $w) => {
  let cellColId = event.cellColumnId;     // "columnId_b2b3-87d9-49250"
  let cellData = event.cellData;          // "John"
  let cellRowIndex = event.cellRowIndex;  // 1
} );
context

context

Gets the context of the event on a repeated element.

Syntax

get context(): Object

Description

The context property only appears in events on repeated elements.

It contains an object with one key:value pair. The key is "itemId" and the value is the ID of the repeated item on which the event occurred.

Type

Object

Examples

Get the context of the event

JHcoIiNteVJlcGVhdGVkRWxlbWVudCIpLm9uRXZlbnQoIChldmVudCwgJHcpID0+IHsKICBsZXQgaXRlbUlkID0gZXZlbnQuY29udGV4dC5pdGVtSWQ7ICAvLyAiaXRlbTEiCn0gKTsK
$w("#myRepeatedElement").onEvent( (event, $w) => {
  let itemId = event.context.itemId;  // "item1"
} );

Mixed In From

$w.Event

target

target

Gets the element that the event was fired on.

Syntax

get target(): string

Type

Element

Examples

Get the ID of the target element

JHcoIiNteUVsZW1lbnQiKS5vbkV2ZW50KCAoZXZlbnQsICR3KSA9PiB7CiAgbGV0IHRhcmdldElkID0gZXZlbnQudGFyZ2V0LmlkOyAgLy8gIm15RWxlbWVudCIKfSApOwo=
$w("#myElement").onEvent( (event, $w) => {
  let targetId = event.target.id;  // "myElement"
} );

Mixed In From

$w.Event

type

type

Gets the type of event that was fired.

Syntax

get type(): string

Type

String

Examples

Get the type of the event

JHcoIiNteUVsZW1lbnQiKS5vbkV2ZW50KCAoZXZlbnQsICR3KSA9PiB7CiAgbGV0IGV2ZW50VHlwZSA9IGV2ZW50LnR5cGU7IC8vICJjbGljayIKfSApOwo=
$w("#myElement").onEvent( (event, $w) => {
  let eventType = event.type; // "click"
} );

Mixed In From

$w.Event