---
title: Extension reference
project: Tables
version: 7.0
section: development
language: en
license: Total.js Enterprise
url: https://totaljs.es/docs/tables/7-0/development/extension-reference/
updated: 2026-11-20T06:51:57.969Z
---

# Extension reference

> The browser events, the helpers of the record window and the server events that extensions use.

Extensions use these events and helpers. Browser events are registered in the `<script>` part of an [extension](../extensions/), server events in the `<script total>` part.

Entries of type **event** are functions that you register and Tables calls. Entries of type **method** are functions that Tables provides.

## API

### ON('detail', function(meta) {})

Type: `event`

Runs in the browser each time a record window opens.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `meta.table` | `Object` | yes |  | The settings of the table: `id`, `name`, `columns` and the others. |
| `meta.columns` | `Array` | yes |  | The fields of the form. Push `{ type: 'custom', html: '...' }` to add your own HTML. |
| `meta.plugin` | `Object` | yes |  | The record window. Functions you add to it can be called from your HTML with `class="exec" data-exec="?/name"`. |
| `meta.response` | `Object` | yes |  | The record as read from the server. |
| `meta.toolbar` | `Array` | yes |  | The buttons of the toolbar of the window. |
| `meta.actions` | `Array` | yes |  | The items of the Actions menu of the window. |

Use it to add fields or buttons to the detail of a record. Check `meta.table.id` to change only one table.

Example: Add a note at the end of the orders
```js
ON('detail', function(meta) {
	if (meta.table.id === 't118h7')
		meta.columns.push({ type: 'custom', html: '<p>Check the stock before you ship.</p>' });
});
```

### ON('listing', function(meta) {})

Type: `event`

Runs in the browser when the list of records of a table is prepared.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `meta.table` | `Object` | yes |  | The settings of the table. |
| `meta.columns` | `Array` | yes |  | The columns of the list. |
| `meta.toolbar` | `Array` | yes |  | The buttons of the toolbar of the list. |
| `meta.element` | `jQuery` | yes |  | The element of the list window. |
| `meta.plugin` | `Object` | yes |  | The list window. |
| `meta.links` | `Array` | yes |  | The tables that link to this table and where the user can create records. |
| `meta.lists` | `Array` | yes |  | The tables that link to this table and that the user can read. |

Use it to inspect or change the list before it is shown.

Example: Log the columns of each list
```js
ON('listing', function(meta) {
	console.log(meta.table.name, meta.columns.length);
});
```

### ON('actions', function(meta) {})

Type: `event`

Runs in the browser when a user opens the Actions menu of a list.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `meta.actions` | `Array` | yes |  | The items of the menu. |
| `meta.table` | `Object` | yes |  | The settings of the table. |
| `meta.items` | `Array` | yes |  | The records on the current page. |
| `meta.plugin` | `Object` | yes |  | The list window. |

Use it to inspect or change the items of the menu before it is shown.

Example: Log the number of items
```js
ON('actions', function(meta) {
	console.log(meta.table.name, meta.actions.length);
});
```

### meta.plugin.collect()

Type: `method`

Returns the current values of the record window.

Available in the `detail` event. The object has the `id`, the `name` and each column under its ID. A relation column holds the ID of the linked record.

Example: Read the amount of an order
```js
let values = meta.plugin.collect();
console.log(values.x04);
```

### meta.plugin.tapi(name, data, callback)

Type: `method`

Calls a server action of Tables or of an extension.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | The name of the action, for example `Orders\|hello`. |
| `data` | `Object` | yes |  | The input of the action. |
| `callback` | `Function` | yes |  | `function(response)` with the answer of the action. |

The call is made with the session of the signed-in user. The action needs a route such as `route: '+API ?'` to be callable from the browser.

Example: Send the record to a server action
```js
meta.plugin.tapi('Orders|hello', meta.plugin.collect(), function(response) {
	alert(response);
});
```

### ON('@Data|save', function($) {})

Type: `event`

Runs on the server each time an operation of Tables is called.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `$.payload` | `Object` | yes |  | The input of the operation. For `Data\|save`: `tableid` and `data`. |
| `$.user` | `Object` | yes |  | The user or API token that called the operation. |

Use the name of the operation after `@`, for example `@Data|save` for every saved record. `$.payload` is the input of the operation and `$.user` the user.

Example: Log every saved order
```js
ON('@Data|save', function($) {
	if ($.payload.tableid === 't118h7')
		console.log('Order saved by', $.user.name);
});
```
