# ReportDesigner.ActionHandlers

## Content

# Interface: ActionHandlers

[ReportDesigner](../modules/ReportDesigner).ActionHandlers

Defines the contract for handling designer actions triggered by UI commands and hotkeys.

**`example`**
```ts
const handlers: ActionHandlers = {
	onSave: async (info) => ({ displayName: info.displayName }),
	onOpen: async () => ({ id: 'report-1', displayName: 'Sales Report' }),
};
```

## Table of contents

### Methods

- [onCreate](ReportDesigner.ActionHandlers#oncreate)
- [onOpen](ReportDesigner.ActionHandlers#onopen)
- [onOpenFileMenu](ReportDesigner.ActionHandlers#onopenfilemenu)
- [onRender](ReportDesigner.ActionHandlers#onrender)
- [onSave](ReportDesigner.ActionHandlers#onsave)
- [onSaveAs](ReportDesigner.ActionHandlers#onsaveas)

## Methods

### <a id="oncreate" name="oncreate"></a> onCreate

▸ `Optional` **onCreate**(): `Promise`<`undefined` \| [`Report`](../modules/ReportDesigner#report) \| [`NewReport`](../modules/ReportDesigner#newreport)\>

Creates a new report or selects a report to open.

**`example`**
```ts
const handlers = {} as ActionHandlers;
const report = await handlers.onCreate?.();
```

#### Returns

`Promise`<`undefined` \| [`Report`](../modules/ReportDesigner#report) \| [`NewReport`](../modules/ReportDesigner#newreport)\>

A promise that resolves to the report, a new report definition, or `undefined` if the operation was canceled.

___

### <a id="onopen" name="onopen"></a> onOpen

▸ `Optional` **onOpen**(): `Promise`<`undefined` \| [`Report`](../modules/ReportDesigner#report)\>

Opens an existing report.

**`example`**
```ts
const handlers = {} as ActionHandlers;
const report = await handlers.onOpen?.();
```

#### Returns

`Promise`<`undefined` \| [`Report`](../modules/ReportDesigner#report)\>

A promise that resolves to the report, or `undefined` if the operation was canceled.

___

### <a id="onopenfilemenu" name="onopenfilemenu"></a> onOpenFileMenu

▸ `Optional` **onOpenFileMenu**(): `void`

Opens a custom file menu.

**`example`**
```ts
const handlers = {} as ActionHandlers;
handlers.onOpenFileMenu?.();
```

#### Returns

`void`

___

### <a id="onrender" name="onrender"></a> onRender

▸ `Optional` **onRender**(`report`, `resourceLocator?`, `uiTheme?`): `Promise`<`void`\>

Renders the current report.

**`example`**
```ts
const handlers = {} as ActionHandlers;
const reportDefinition = {} as ReportDefinition;
const resourceLocator = {} as Partial<ResourceLocator>;
await handlers.onRender?.(reportDefinition, resourceLocator, 'Default');
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `report` | [`ReportDefinition`](../modules/ReportDesigner#reportdefinition) | The report definition to render. |
| `resourceLocator?` | `Partial`<[`ResourceLocator`](../modules/Core#resourcelocator)\> | The resource locator to resolve external resources. |
| `uiTheme?` | `UITheme` | The current UI theme. |

#### Returns

`Promise`<`void`\>

___

### <a id="onsave" name="onsave"></a> onSave

▸ `Optional` **onSave**(`options`): `Promise`<`undefined` \| [`SaveResult`](../modules/ReportDesigner#saveresult)\>

Saves the current report.

**`example`**
```ts
const handlers = {} as ActionHandlers;
const saveInfo = {} as SaveReportInfo;
const result = await handlers.onSave?.(saveInfo);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `options` | [`SaveReportInfo`](../modules/ReportDesigner#savereportinfo) | The report information to save. |

#### Returns

`Promise`<`undefined` \| [`SaveResult`](../modules/ReportDesigner#saveresult)\>

A promise that resolves to the save result, or `undefined` if the operation was canceled.

___

### <a id="onsaveas" name="onsaveas"></a> onSaveAs

▸ `Optional` **onSaveAs**(`options`): `Promise`<`undefined` \| [`SaveAsResult`](../modules/ReportDesigner#saveasresult)\>

Saves the current report as a new report.

**`example`**
```ts
const handlers = {} as ActionHandlers;
const saveNewInfo = {} as SaveNewReportInfo;
const result = await handlers.onSaveAs?.(saveNewInfo);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `options` | [`SaveNewReportInfo`](../modules/ReportDesigner#savenewreportinfo) | The report information to save as new. |

#### Returns

`Promise`<`undefined` \| [`SaveAsResult`](../modules/ReportDesigner#saveasresult)\>

A promise that resolves to the save-as result, or `undefined` if the operation was canceled.
