API
API
PivotBook

PivotBook

ํ”ผ๋ฒ— ๋ถ(PivotBook) ์ „์ฒด๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ตœ์ƒ์œ„ ๋ชจ๋ธ.

Properties

explorer: PivotExplorer readonly

Pivot table explorer.

default: undefined

footer: PivotBookFooter readonly

Pivot book footer.

default: undefined

header: PivotBookHeader readonly

Pivot book header.

default: undefined

headline: PivotHeadline readonly

Pivot book headline.

default: undefined

inspector: PivotInspector readonly

Pivot table inspector.

default: undefined

listenerCount: number (opens in a new tab) readonly

๋“ฑ๋ก๋œ ๋ฆฌ์Šค๋„ˆ ๊ฐœ์ˆ˜๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

default: undefined

tableCount: number (opens in a new tab) readonly

Number of pivot tables in this book.

default: undefined

tables: Array (opens in a new tab)<PivotBookPage> readonly

Pivot tables in this book.

default: undefined

Methods

addListener(listener): void (opens in a new tab)

์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค.

ParameterTypeDescription
listenerIPivotBookEvents์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ

beginUpdate(): void (opens in a new tab)

์ด๋ฒคํŠธ ๋ฐœ์ƒ์„ ์ผ์‹œ์ ์œผ๋กœ ์ค‘๋‹จํ•œ๋‹ค.
beginUpdate()์™€ endUpdate()๋Š” ์ค‘์ฒฉ ํ˜ธ์ถœ์„ ์ง€์›ํ•œ๋‹ค. endUpdate() ํ˜ธ์ถœ ํšŸ์ˆ˜๊ฐ€ beginUpdate() ํ˜ธ์ถœ ํšŸ์ˆ˜์™€ ๊ฐ™์•„์ง€๋ฉด ์ด๋ฒคํŠธ ๋ฐœ์ƒ์ด ์žฌ๊ฐœ๋œ๋‹ค.

์ค‘์š”: ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์—๋„ endUpdate()๊ฐ€ ๋ฐ˜๋“œ์‹œ ํ˜ธ์ถœ๋˜๋„๋ก try-finally ํŒจํ„ด์„ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.

table.beginUpdate();
try {
    table.setValue(0, 0, 'value1');
    table.setValue(0, 1, 'value2');
    table.updateRow(1, ['a', 'b', 'c']);
    // ... ์—ฌ๋Ÿฌ ์ž‘์—…๋“ค
} finally {
    table.endUpdate();
}

clearListeners(): void (opens in a new tab)

๋ชจ๋“  ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์ œ๊ฑฐํ•œ๋‹ค.

dispose(): null

๊ฐ์ฒด๋ฅผ ํ•ด์ œํ•˜๊ณ  null์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.
์‚ฌ์šฉ ์˜ˆ: this._obj = this._obj.dispose();

returnย null

endUpdate(): void (opens in a new tab)

์ด๋ฒคํŠธ ๋ฐœ์ƒ์„ ์žฌ๊ฐœํ•œ๋‹ค.
beginUpdate() ํ˜ธ์ถœ ํšŸ์ˆ˜๋งŒํผ endUpdate()๋ฅผ ํ˜ธ์ถœํ•ด์•ผ ์ด๋ฒคํŠธ ๋ฐœ์ƒ์ด ์žฌ๊ฐœ๋œ๋‹ค.

์ค‘์š”: try-finally ๋ธ”๋ก์˜ finally์—์„œ ํ˜ธ์ถœํ•˜์—ฌ ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์—๋„ ์‹คํ–‰๋˜๋„๋ก ํ•ด์•ผ ํ•œ๋‹ค.

isUpdating(): boolean (opens in a new tab)

ํ˜„์žฌ ์ด๋ฒคํŠธ ๋ฐœ์ƒ์ด ์ค‘๋‹จ๋œ ์ƒํƒœ์ธ์ง€ ํ™•์ธํ•œ๋‹ค.

returnย ์ด๋ฒคํŠธ ๋ฐœ์ƒ์ด ์ค‘๋‹จ๋œ ์ƒํƒœ์ด๋ฉด true, ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด false

load(cm, config, callback?): void (opens in a new tab)

Loads the pivot book with the specified configuration.

ParameterTypeDescription
cmPivotCubeManagerCube manager instance used to manage data cubes.
configPivotBookConfigurationPivot book configuration to load.
callback(book: PivotBook) => voidOptional callback function invoked after the book is loaded.

off(eventName, handler): boolean (opens in a new tab)

ํŠน์ • ์ด๋ฒคํŠธ์—์„œ ํ•ธ๋“ค๋Ÿฌ๋ฅผ ์ œ๊ฑฐํ•œ๋‹ค.

const handler = (sender, row) => console.log(row);
table.on('onRowUpdated', handler);
table.off('onRowUpdated', handler);
ParameterTypeDescription
eventNamenever์ด๋ฒคํŠธ ์ด๋ฆ„
handlerIPivotBookEvents\[K]์ œ๊ฑฐํ•  ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ ํ•จ์ˆ˜

returnย ์ œ๊ฑฐ ์„ฑ๊ณต ์—ฌ๋ถ€

on(eventName, handler): void (opens in a new tab)

ํŠน์ • ์ด๋ฒคํŠธ์— ํ•ธ๋“ค๋Ÿฌ๋ฅผ ๋“ฑ๋กํ•œ๋‹ค.
addEventListener()๋ณด๋‹ค ๊ฐ„ํŽธํ•œ ๋ฐฉ์‹์œผ๋กœ ๊ฐœ๋ณ„ ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๋ฅผ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋‹ค.

table.on('onRowUpdated', (sender, row, oldValues) => {
    console.log('Row updated:', row);
});
ParameterTypeDescription
eventNamenever์ด๋ฒคํŠธ ์ด๋ฆ„
handlerIPivotBookEvents\[K]์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ ํ•จ์ˆ˜

removeListener(listener): boolean (opens in a new tab)

์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์ œ๊ฑฐํ•œ๋‹ค.

ParameterTypeDescription
listenerIPivotBookEvents์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ

returnย ์ œ๊ฑฐ ์„ฑ๊ณต ์—ฌ๋ถ€

resetUpdate(): void (opens in a new tab)

์ด๋ฒคํŠธ ๋ฝ ์นด์šดํ„ฐ๋ฅผ ๊ฐ•์ œ๋กœ 0์œผ๋กœ ๋ฆฌ์…‹ํ•œ๋‹ค.

๊ฒฝ๊ณ : ์ด ๋ฉ”์„œ๋“œ๋Š” ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋ˆ„๋ฝ ๋“ฑ์œผ๋กœ ์ธํ•ด ์ด๋ฒคํŠธ ๋ฝ์ด ์˜๊ตฌ์ ์œผ๋กœ ๊ฑธ๋ฆฐ ๊ฒฝ์šฐ์—๋งŒ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค. ์ •์ƒ์ ์ธ ํ๋ฆ„์—์„œ๋Š” beginUpdate()/endUpdate()๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.

// ๋””๋ฒ„๊น…์ด๋‚˜ ์—๋Ÿฌ ๋ณต๊ตฌ ์‹œ
if (table.isUpdating()) {
    console.warn('Event lock is stuck, resetting...');
    table.resetUpdate();
}

save(): PivotBookConfiguration

Saves the current state of the pivot book into a configuration object.

returnย The configuration object representing the current state of the pivot book.