Skip to content
Mog is in active development. The GitHub repo, SDK packages, and community channels are not yet available. Follow for launch updates

ws.slicers

WorksheetSlicers

Sub-API for slicer operations on a worksheet.

13 methods

add

Promise<string>
add(config: SlicerConfig): Promise<string>;
ParameterTypeRequired
configSlicerConfigrequired

Create a new slicer on this worksheet. @param config - Slicer configuration (table, column, position) @returns The ID of the created slicer

remove

Promise<void>
remove(slicerId: string): Promise<void>;
ParameterTypeRequired
slicerIdstringrequired

Remove a slicer from this worksheet. @param slicerId - ID of the slicer to remove

list

Promise<SlicerInfo[]>
list(): Promise<SlicerInfo[]>;

List all slicers on this worksheet. @returns Array of slicer summary information

get

Promise<Slicer | null>
get(slicerId: string): Promise<Slicer | null>;
ParameterTypeRequired
slicerIdstringrequired

Get a slicer by ID, including full state. @param slicerId - ID of the slicer @returns Full slicer state, or null if not found

getItemAt

Promise<SlicerInfo | null>
getItemAt(index: number): Promise<SlicerInfo | null>;
ParameterTypeRequired
indexnumberrequired

Get a slicer by its zero-based index in the list. @param index - Zero-based index of the slicer @returns Slicer summary information, or null if index is out of range

getItems

Promise<SlicerItem[]>
getItems(slicerId: string): Promise<SlicerItem[]>;
ParameterTypeRequired
slicerIdstringrequired

Get the items (values) available in a slicer. @param slicerId - ID of the slicer @returns Array of slicer items with selection state

getItem

Promise<SlicerItem>
getItem(slicerId: string, key: CellValue): Promise<SlicerItem>;
ParameterTypeRequired
slicerIdstringrequired
keyCellValuerequired

Get a slicer item by its string key. @param slicerId - ID of the slicer @param key - The value to look up (matched via string coercion) @returns The matching slicer item @throws KernelError if no item matches the key

getItemOrNullObject

Promise<SlicerItem | null>
getItemOrNullObject(slicerId: string, key: CellValue): Promise<SlicerItem | null>;
ParameterTypeRequired
slicerIdstringrequired
keyCellValuerequired

Get a slicer item by its string key, or null if not found. @param slicerId - ID of the slicer @param key - The value to look up (matched via string coercion) @returns The matching slicer item, or null if not found

setSelection

Promise<void>
setSelection(slicerId: string, selectedItems: CellValue[]): Promise<void>;
ParameterTypeRequired
slicerIdstringrequired
selectedItemsCellValue[]required

Set the selected items in a slicer, replacing any existing selection. @param slicerId - ID of the slicer @param selectedItems - Array of values to select

clearSelection

Promise<void>
clearSelection(slicerId: string): Promise<void>;
ParameterTypeRequired
slicerIdstringrequired

Clear all selections in a slicer (show all items). @param slicerId - ID of the slicer

duplicate

Promise<string>
duplicate(slicerId: string, offset?: { x?: number; y?: number }): Promise<string>;
ParameterTypeRequired
slicerIdstringrequired
offset{ x?: number; y?: number }optional

Duplicate a slicer with an optional position offset. @param slicerId - ID of the slicer to duplicate @param offset - Position offset in pixels (defaults to { x: 20, y: 20 }) @returns The ID of the newly created slicer

updateConfig

Promise<void>
updateConfig(slicerId: string, updates: Partial<SlicerConfig>): Promise<void>;
ParameterTypeRequired
slicerIdstringrequired
updatesPartial<SlicerConfig>required

Update a slicer's configuration. @param slicerId - ID of the slicer @param updates - Partial configuration updates

getState

Promise<SlicerState>
getState(slicerId: string): Promise<SlicerState>;
ParameterTypeRequired
slicerIdstringrequired

Get the enriched runtime state of a slicer. @param slicerId - ID of the slicer @returns Enriched slicer state including computed items and connection status