# PivotTableApi (@salmonui/pivot-table)

> The PivotTableApi interface of @salmonui/pivot-table: Instance API of PivotTable (ref).

Canonical: https://salmonui.dev/docs/reference/pivot-table/PivotTableApi

```ts
import type { PivotTableApi } from '@salmonui/pivot-table';
```

Entry index: https://salmonui.dev/docs/reference/pivot-table (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/pivot-table.md).

## Reference

Kind: interface

```ts
interface PivotTableApi<Row = unknown> {
    readonly pivot: PivotController<Row>;
    readonly element: HTMLDivElement | null;
    readonly grid: DataGridApi<PivotRowStub> | null;
    getResult(): PivotResult | null;
    getState(): PivotTableState;
    restoreState(state: PivotTableState | string): boolean;
    exportToExcel(options?: PivotExportOptions): Promise<PivotExportFile | null>;
    exportToCsv(options?: PivotExportOptions): Promise<PivotExportFile | null>;
    exportToPdf(options?: PivotExportOptions): Promise<PivotExportFile | null>;
    print(): Promise<null>;
    openFieldList(): void;
    openCalculatedFieldEditor(name?: string): void;
    openConditionalFormatEditor(): void;
    openNumberFormatEditor(measure?: string): void;
    refresh(): void;
}
```

Instance API of `PivotTable` (`ref`).

Members (15):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `pivot` | `readonly pivot: PivotController<Row>;` |  |  |
| `element` | `readonly element: HTMLDivElement \| null;` |  | The root element; null before mount. |
| `grid` | `readonly grid: DataGridApi<PivotRowStub> \| null;` |  | The inner Data Grid instance (renderer); null before mount. |
| `getResult` | `getResult(): PivotResult \| null;` |  |  |
| `getState` | `getState(): PivotTableState;` |  |  |
| `restoreState` | `restoreState(state: PivotTableState \| string): boolean;` |  |  |
| `exportToExcel` | `exportToExcel(options?: PivotExportOptions): Promise<PivotExportFile \| null>;` |  |  |
| `exportToCsv` | `exportToCsv(options?: PivotExportOptions): Promise<PivotExportFile \| null>;` |  |  |
| `exportToPdf` | `exportToPdf(options?: PivotExportOptions): Promise<PivotExportFile \| null>;` |  |  |
| `print` | `print(): Promise<null>;` |  |  |
| `openFieldList` | `openFieldList(): void;` |  |  |
| `openCalculatedFieldEditor` | `openCalculatedFieldEditor(name?: string): void;` |  |  |
| `openConditionalFormatEditor` | `openConditionalFormatEditor(): void;` |  |  |
| `openNumberFormatEditor` | `openNumberFormatEditor(measure?: string): void;` |  |  |
| `refresh` | `refresh(): void;` |  |  |
