Summary Header
Module Extensions
Section titled “Module Extensions”ColumnRegular (Extended from @revolist/revogrid)
Section titled “ColumnRegular (Extended from @revolist/revogrid)”interface ColumnRegular { /** * Add summaryVNode property to ColumnRegular interface */ summaryVNode?(h: HyperFunc<VNode>, summary: Record<string, number>): VNode}Plugin API
Section titled “Plugin API”SummaryChartHeaderPlugin
Section titled “SummaryChartHeaderPlugin”The SummaryChartHeaderPlugin is a RevoGrid plugin that enhances the grid’s column headers by
allowing custom summary visualizations to be displayed. This plugin leverages a custom property
summaryVNode added to the ColumnRegular interface, enabling developers to inject summary
charts or visual indicators based on column data summaries.
Key Features:
- Custom Header Augmentation: Modifies the default column header template to include a summary
chart or visualization as defined by the
summaryVNodeproperty in the column configuration. - Event-Driven Rendering: Listens to the
BEFORE_HEADER_RENDER_EVENTto dynamically wrap and modify header templates, ensuring seamless integration with existing grid structures. - Summary Calculation: Provides a mechanism to calculate summary data for each column, allowing for flexible and dynamic summary representations based on the grid’s row data.
- Styling Support: Automatically adds a CSS class for plugin-specific styling, enabling custom styles to be applied to headers enhanced by this plugin.
Usage:
- Integrate this plugin into a RevoGrid instance’s
pluginsarray to enable summary chart headers. - Define
summaryVNodein column configurations to specify the chart or visualization logic.
Example
Section titled “Example”import { SummaryChartHeaderPlugin } from '@revolist/revogrid-pro'
const grid = document.createElement('revo-grid');grid.plugins = [SummaryChartHeaderPlugin];grid.columns = [ { prop: 'sales', name: 'Sales', summaryVNode: (h, summary) => h('div', {}, `Total: ${summary['Total'] || 0}`), },];By using the SummaryChartHeaderPlugin, developers can enhance their RevoGrid instances with
visually informative headers, improving data insights and user experience within the grid.
class SummaryChartHeaderPlugin {}