Vue API
API Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
mode | 'default' | 'minimal' | 'none' | 'default' | Display mode |
data | PivotDataRecord[] | undefined | Input data array |
options | PivotOptions | undefined | Pivot configuration |
filters | FilterConfig[] | undefined | Active filters |
pagination | Partial<PaginationConfig> | undefined | Pagination settings |
class | string | undefined | CSS class |
style | Record<string, string> | string | undefined | Inline styles |
Events
| Event | Payload | Description |
|---|---|---|
@state-change | PivotTableState | Emitted when pivot state changes |
@view-mode-change | { mode: 'raw' | 'processed' } | Emitted when view mode changes |
@pagination-change | PaginationConfig | Emitted when pagination changes |
Template Ref Methods
Access these methods through template refs:
<template>
<PivotHead ref="pivotRef" ... />
</template>
<script setup>
const pivotRef = ref();
// Use methods
const exportData = () => {
pivotRef.value?.exportToExcel('my-data');
};
</script>
Core Methods
getState()- Get current pivot staterefresh()- Refresh the pivot tablegetData()- Get raw input datagetProcessedData()- Get processed pivot data
Filtering & Sorting
sort(field: string, direction: 'asc' | 'desc')- Sort by fieldgetFilters()- Get current filtersgetFilteredData()- Get filtered raw datagetFilteredAndProcessedData()- Get filtered and processed data
Configuration
setMeasures(measures: MeasureConfig[])- Update measuressetDimensions(dimensions: Dimension[])- Update dimensionssetGroupConfig(config: GroupConfig)- Update grouping
Formatting
formatValue(value: unknown, field: string)- Format a valueupdateFieldFormatting(field: string, format: FormatOptions)- Update field formattinggetFieldAlignment(field: string)- Get field text alignmentshowFormatPopup()- Show formatting popup
Pagination
getPagination()- Get pagination statepreviousPage()- Go to previous pagenextPage()- Go to next pagesetPageSize(size: number)- Set page sizegoToPage(page: number)- Go to specific page
View Modes
setViewMode(mode: 'raw' | 'processed')- Set view modegetViewMode()- Get current view mode
Export
exportToHTML(fileName?: string)- Export to HTMLexportToPDF(fileName?: string)- Export to PDFexportToExcel(fileName?: string)- Export to ExcelopenPrintDialog()- Open print dialog
Drag & Drop
swapRows(from: number, to: number)- Swap row positionsswapColumns(from: number, to: number)- Swap column positions