ws.slicers
WorksheetSlicers
Sub-API for slicer operations on a worksheet.
13 methods
add
→ Promise<string>add(config: SlicerConfig): Promise<string>;| Parameter | Type | Required |
|---|---|---|
| config | SlicerConfig | required |
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>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
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>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
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>;| Parameter | Type | Required |
|---|---|---|
| index | number | required |
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[]>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
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>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
| key | CellValue | required |
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>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
| key | CellValue | required |
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>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
| selectedItems | CellValue[] | 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>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
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>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
| 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>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
| updates | Partial<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>;| Parameter | Type | Required |
|---|---|---|
| slicerId | string | required |
Get the enriched runtime state of a slicer. @param slicerId - ID of the slicer @returns Enriched slicer state including computed items and connection status