TX Sheet Control

Editorui.pivotTables Property

Property

The pivot collection UI controller exposes visible, show(pivot?), hide() and insert(). It controls the field-list pane and create dialog.

Example

Use a ready editor workbook in the browser or a server control workbook in Node.js.

import { Workbook as ExampleWorkbook } from '@txtextcontrol/tx-sheet-control';
const workbook = new ExampleWorkbook();

import { Spreadsheet } from '@txtextcontrol/tx-sheet-control';
const host = document.createElement('div');
host.style.height = '600px';
document.body.append(host);
const editor = new Spreadsheet(host, { license: 'YOUR_SIGNED_LICENSE', fontCatalogURL: '/assets/sheet/fonts/catalog.json' });
await editor.ready;

const source = workbook.sheets.at(0);
source.range('A1:D5').setValues([
    ['Region', 'Category', 'Revenue', 'Cost'],
    ['Europe', 'Software', 1250, 500],
    ['Europe', 'Services', 700, 350],
    ['Americas', 'Software', 1800, 900],
    ['Americas', 'Services', 950, 400]
]);
const report = workbook.sheets.add('Sales Summary');
const pivot = report.pivotTables.add({
    name: 'RegionalSales',
    source: { sheetId: source.id, range: 'A1:D5' },
    destination: { sheetId: report.id, cell: 'B3' },
    rows: [{ field: 'Region' }],
    columns: [{ field: 'Category' }],
    values: [{ field: 'Revenue', caption: 'Sales', numberFormatCode: '$#,##0.00' }],
    layout: 'tabular', style: { rowBanding: true }
});

editor.ui.pivotTables.show(pivot);
editor.ui.pivotTables.hide();
editor.ui.pivotTables.insert();

See Pivot Tables.

Replace YOUR_SIGNED_LICENSE with your issued Trial, Developer or OEM token before running the editor example.