Sync grid controls in frameworks
Grid controls need to know which grid they work with. For example, History Controls must follow the grid’s edit history to show when Undo and Redo are available and apply those actions to the right grid.
In Vue, React, and Angular, place the grid and its controls inside a GridControlsProvider. The provider connects them when the grid is ready and keeps the connection up to date if the grid is removed or replaced. You don’t need to pass a grid reference to each control.
This example uses HistoryPlugin to add undo and redo to the grid. Open Source code to see the Vue, React, Angular, and vanilla TypeScript implementations.
Source code
import './external-ast.css';import { defineCustomElements } from '@revolist/revogrid/loader';import { AdvanceFilterPlugin, DateRangeColumnsPlugin, CellValidatePlugin, TooltipPlugin, CellFlashPlugin, defineHistoryControls, HistoryPlugin, InfoPanelPlugin, EventManagerPlugin,} from '@revolist/revogrid-pro';import type { FilterAst } from '@revolist/revogrid-pro';import { cellFlash, clipboard, columns, createPeopleStore } from './store';defineCustomElements();export function load(parentSelector: string) { const parent = document.querySelector(parentSelector); if (!parent) throw new Error('Demo container not found'); const section = document.createElement('section'); const grid = document.createElement('revo-grid'); section.className = 'external-ast-demo'; section.style.cssText = 'height: 240px; min-height: 0; display: flex; flex-direction: column'; const toolbar = document.createElement('div'); const gridContainer = document.createElement('div'); gridContainer.style.cssText = 'display: flex; flex-direction: row; height: 100%; min-height: 0; flex: 1 1 auto'; const store = createPeopleStore((visible) => { grid.source = visible; }); grid.style.cssText = 'height: 200px; min-height: 0; flex: 1 1 auto'; grid.theme = 'compact'; grid.columns = columns; grid.cellFlash = cellFlash; grid.range = true; grid.useClipboard = clipboard; grid.filter = store.filterConfig; grid.plugins = [ DateRangeColumnsPlugin, AdvanceFilterPlugin, EventManagerPlugin, CellValidatePlugin, TooltipPlugin, CellFlashPlugin, HistoryPlugin, InfoPanelPlugin, ]; grid.hideAttribution = true; grid.eventManager = store.eventManager; grid.addEventListener( 'beforefilterapply', (event: CustomEvent<{ filterAst?: FilterAst }>) => store.setFilter(event.detail.filterAst), ); gridContainer.append(grid); section.append(toolbar, gridContainer); parent.appendChild(section); const disposeHistory = defineHistoryControls(toolbar, grid); store.refresh(); return () => { disposeHistory(); section.remove(); };}<template> <section class="external-ast-demo" style="height: 240px; min-height: 0; display: flex; flex-direction: column" > <GridControlsProvider> <HistoryControls /> <div class="external-ast-main"> <VGrid style="height: 200px; min-height: 0; flex: 1 1 auto" theme="compact" :columns="columns" :cell-flash.prop="cellFlash" :use-clipboard="clipboard" range :source="visible" :plugins="plugins" :filter="store.filterConfig" :event-manager.prop="store.eventManager" @beforefilterapply="onFilter" hide-attribution /> <InfoPanel /> </div> </GridControlsProvider> </section></template><script setup lang="ts">import { shallowRef } from 'vue';import { VGrid } from '@revolist/vue3-datagrid';import { GridControlsProvider, HistoryControls, InfoPanel,} from '@revolist/revogrid-pro/vue';import './external-ast.css';import { AdvanceFilterPlugin, DateRangeColumnsPlugin, CellValidatePlugin, TooltipPlugin, CellFlashPlugin, HistoryPlugin, InfoPanelPlugin, EventManagerPlugin,} from '@revolist/revogrid-pro';import type { FilterAst } from '@revolist/revogrid-pro';import { cellFlash, clipboard, columns, createPeopleStore, type Person,} from './store';const visible = shallowRef<Person[]>([]);const store = createPeopleStore((view) => { visible.value = view;});const plugins = [ DateRangeColumnsPlugin, AdvanceFilterPlugin, EventManagerPlugin, CellValidatePlugin, TooltipPlugin, CellFlashPlugin, HistoryPlugin, InfoPanelPlugin,];function onFilter(event: CustomEvent<{ filterAst?: FilterAst }>) { store.setFilter(event.detail.filterAst);}store.refresh();</script>import './external-ast.css';import React, { useMemo, useState } from 'react';import { RevoGrid } from '@revolist/react-datagrid';import { GridControlsProvider, HistoryControls, InfoPanel,} from '@revolist/revogrid-pro/react';import { AdvanceFilterPlugin, DateRangeColumnsPlugin, CellValidatePlugin, TooltipPlugin, CellFlashPlugin, HistoryPlugin, InfoPanelPlugin, EventManagerPlugin,} from '@revolist/revogrid-pro';import type { FilterAst } from '@revolist/revogrid-pro';import { cellFlash, clipboard, columns, createPeopleStore, type Person,} from './store';export default function ExternalAst(_props: { rows?: unknown[] }) { const [visible, setVisible] = useState<Person[]>([]); const store = useMemo(() => createPeopleStore(setVisible), []); const plugins = useMemo( () => [ DateRangeColumnsPlugin, AdvanceFilterPlugin, EventManagerPlugin, CellValidatePlugin, TooltipPlugin, CellFlashPlugin, HistoryPlugin, InfoPanelPlugin, ], [], ); React.useEffect(() => { store.refresh(); }, [store]); return ( <GridControlsProvider> <section className="external-ast-demo" style={{ height: 240, minHeight: 0, display: 'flex', flexDirection: 'column', }} > <HistoryControls /> <div className="external-ast-main"> <RevoGrid theme="compact" style={{ height: 200, minHeight: 0, flex: '1 1 auto' }} columns={columns} cellFlash={cellFlash} useClipboard={clipboard} range source={visible} plugins={plugins} filter={store.filterConfig} eventManager={store.eventManager} hide-attribution onBeforefilterapply={( event: CustomEvent<{ filterAst?: FilterAst }>, ) => store.setFilter(event.detail.filterAst)} /> <InfoPanel /> </div> </section> </GridControlsProvider> );}import './external-ast.css';import { Component, NO_ERRORS_SCHEMA, ViewEncapsulation, signal,} from '@angular/core';import { RevoGrid } from '@revolist/angular-datagrid';import { GridControlsProvider, HistoryControls, InfoPanel,} from '@revolist/revogrid-pro/angular';import { AdvanceFilterPlugin, DateRangeColumnsPlugin, CellValidatePlugin, TooltipPlugin, CellFlashPlugin, HistoryPlugin, InfoPanelPlugin, EventManagerPlugin,} from '@revolist/revogrid-pro';import type { FilterAst } from '@revolist/revogrid-pro';import { cellFlash, clipboard, columns, createPeopleStore, type Person,} from './store';@Component({ selector: 'external-ast-grid', standalone: true, imports: [RevoGrid, GridControlsProvider, HistoryControls, InfoPanel], schemas: [NO_ERRORS_SCHEMA], encapsulation: ViewEncapsulation.None, template: `<section class="external-ast-demo" style="height: 240px; min-height: 0; display: flex; flex-direction: column" > <revo-grid-controls-provider> <revo-history-controls></revo-history-controls> <div class="external-ast-main"> <revo-grid style="height: 200px; min-height: 100px !important; flex: 1 1 0 !important" [theme]="'compact'" [columns]="columns" [cellFlash]="cellFlash" [useClipboard]="clipboard" [range]="true" [source]="visible()" [plugins]="plugins" [filter]="store.filterConfig" [eventManager]="store.eventManager" (beforefilterapply)="onFilter($event)" hide-attribution ></revo-grid> <revo-info-panel></revo-info-panel> </div> </revo-grid-controls-provider> </section>`,})export class ExternalAstGridComponent { columns = columns; cellFlash = cellFlash; clipboard = clipboard; plugins = [ DateRangeColumnsPlugin, AdvanceFilterPlugin, EventManagerPlugin, CellValidatePlugin, TooltipPlugin, CellFlashPlugin, HistoryPlugin, InfoPanelPlugin, ]; visible = signal<Person[]>([]); store = createPeopleStore((view) => this.visible.set(view)); constructor() { this.store.refresh(); } onFilter(event: Event) { const detail = (event as CustomEvent<{ filterAst?: FilterAst }>).detail; this.store.setFilter(detail.filterAst); }}import { filterCoreFunctionsIndexedByType } from '@revolist/revogrid';import type { ColumnRegular } from '@revolist/revogrid';import { compileFilterAst, ColumnNumber, createExternalEditHistoryCommands, expandDateRangeColumns,} from '@revolist/revogrid-pro';import type { EventManagerConfig, ExternalEditCandidate, FilterAst,} from '@revolist/revogrid-pro';
export interface Person { [key: string]: string | number; id: number; firstName: string; team: string;}function isNonEmptyText(value: unknown) { return typeof value === 'string' && value.trim().length > 0;}function isNumber(value: unknown) { return ( (typeof value === 'number' || (typeof value === 'string' && value.trim() !== '')) && Number.isFinite(Number(value)) );}const dateKeys = ['hours:2026-11-26', 'hours:2026-11-27', 'hours:2026-11-28'];// Frameworks may install the committed projection after the edit event.export const cellFlash = { clearOnSourceChange: false, flashOnExternalReject: true, duration: 5000, rejectionDuration: 5000,};export const clipboard = { validationResolution: 'valid-cells' } as const;export const columns: ColumnRegular[] = [ { prop: 'firstName', name: 'First Name', size: 170, validate: isNonEmptyText, validationTooltip: () => 'Enter a non-empty value', flash: true, }, { prop: 'team', name: 'Team', size: 170, validate: isNonEmptyText, validationTooltip: () => 'Enter a non-empty value', flash: true, }, { prop: 'hours', size: 170, filter: 'number', cellProperties: ColumnNumber.cellProperties, validate: isNumber, validationTooltip: () => 'Enter a number', flash: true, dateRangeColumns: { start: '2026-11-26', end: '2026-11-28', unit: 'day', column: (slot) => ({ name: slot.date }), }, },];const filterColumns = expandDateRangeColumns(columns) as ColumnRegular[];/** The application owns every record and publishes only the matching view. */export function createPeopleStore(publish: (visible: Person[]) => void) { let rows: Person[] = [ { id: 1, firstName: 'Anna', team: 'Design', 'hours:2026-11-26': 4, 'hours:2026-11-27': 6, 'hours:2026-11-28': 3, }, { id: 2, firstName: 'Ben', team: 'Engineering', 'hours:2026-11-26': 8, 'hours:2026-11-27': 5, 'hours:2026-11-28': 7, }, { id: 3, firstName: 'Cara', team: 'Support', 'hours:2026-11-26': 6, 'hours:2026-11-27': 4, 'hours:2026-11-28': 5, }, { id: 4, firstName: 'David', team: 'Engineering', 'hours:2026-11-26': 7, 'hours:2026-11-27': 8, 'hours:2026-11-28': 6, }, ]; let ast: FilterAst | undefined; const refresh = () => { const compiled = ast && compileFilterAst(ast, { columns: filterColumns, operators: filterCoreFunctionsIndexedByType, }); publish( rows .filter((row) => !compiled || compiled.matches(row)) .map((row) => ({ ...row })), ); }; const filterConfig = { external: true, predefinedFilters: true, groupedFilter: { openByDefault: true, // Preview the complete store, not just the rows currently in the grid. preview: ({ ast: previewAst }: { ast?: FilterAst }) => { const predicate = previewAst && compileFilterAst(previewAst, { columns: filterColumns, operators: filterCoreFunctionsIndexedByType, }); return { matching: rows.filter((row) => !predicate || predicate.matches(row)) .length, total: rows.length, }; }, }, }; function applyChanges( candidates: readonly Pick< ExternalEditCandidate, 'id' | 'rowKey' | 'prop' | 'previousValue' | 'proposedValue' >[], atomic: boolean, signal: AbortSignal, ) { const next = new Map(rows.map((row) => [row.id, row])); const results = candidates.map( ({ id, rowKey, prop, previousValue, proposedValue }) => { const row = typeof rowKey === 'number' ? next.get(rowKey) : undefined; const numeric = typeof prop === 'string' && dateKeys.includes(prop); const value = numeric && isNumber(proposedValue) ? Number(proposedValue) : proposedValue; if ( !row || (prop !== 'firstName' && prop !== 'team' && !numeric) || !(numeric ? isNumber(value) : isNonEmptyText(value)) || row[prop] !== previousValue ) { return { id, status: 'rejected' as const, message: 'The value is invalid or has changed.', }; } if (row[prop] === value) return { id, status: 'unchanged' as const }; next.set(row.id, { ...row, [prop]: value as string | number }); return { id, status: 'changed' as const, value }; }, ); signal.throwIfAborted(); if (atomic && results.some((result) => result.status !== 'changed')) return results; if (results.some((result) => result.status === 'changed')) { rows = [...next.values()]; revision++; } return results; }
let revision = 0; const eventManager: EventManagerConfig = { externalEdit: { sourceVersion: 'people', getRowKey: (row) => row.id, history: createExternalEditHistoryCommands({ resourceId: 'people', submit({ operationId, command }, { signal }) { const results = applyChanges( command.changes.map((change, id) => ({ ...change, id })), true, signal, ); return results.every((result) => result.status === 'changed') ? { operationId, status: 'accepted', revision, changes: null } : { operationId, status: 'rejected', message: 'A record has changed or is no longer available.', }; }, applyAccepted: refresh, }), apply({ candidates, signal }) { const results = applyChanges(candidates, false, signal); if (results.some((result) => result.status === 'changed')) refresh(); return results; }, }, }; return { eventManager, filterConfig, refresh, setFilter(filterAst?: FilterAst) { // Source replacement may re-emit the current filter; avoid a feedback loop. if (JSON.stringify(ast) === JSON.stringify(filterAst)) return; ast = filterAst; refresh(); }, };}.external-ast-demo .external-ast-main { display: flex; /* The preview shell otherwise stacks any container with a direct grid. */ flex-direction: row !important; flex: 1 1 auto; min-height: 0; min-width: 0;}
.external-ast-main revo-grid { min-width: 0;}
.external-ast-demo revo-grid .rgCell[invalid]:not([flash]) { background-color: transparent; color: inherit; box-shadow: none;}
.external-ast-demo revo-grid .rgCell[invalid]:not([flash]) .validation-indicator { display: none;}How the connection works
Section titled “How the connection works”YOUR FRAMEWORK COMPONENT TREE
01 · GRID
RevoGrid
HistoryPlugin installed
One grid in each scope
02 · SCOPE
GridControlsProvider
Tracks the current grid
Shares it with controls
03 · CONTROL
HistoryControls
Undo / redo actions
Live counts and state
The control sends commands to the grid and listens for history changes.
Overrides the scope; null disconnects the control.
Grid replacement or removal releases the old connection.
- Add your normal grid component and controls inside the provider.
- The provider connects the controls when the grid is ready. History Controls then follow the grid’s history.
- If the grid is removed or replaced, the provider disconnects the old grid and connects the new one.
Each provider connects one grid. Use separate or nested providers for independent grids. A provider reports an error if it contains more than one grid; an Angular content query does not look inside another component’s private view.
Set it up
Section titled “Set it up”Install RevoGrid Pro and the grid wrapper for your framework using the installation guide. Import @revolist/revogrid-pro/styles.css once in your application. Use the grid wrapper for your framework; Angular requires version 22.2 or newer.
The framework adapters do not install their framework or grid wrapper. Install the dependencies for the adapter you use:
| Adapter | Required packages |
|---|---|
@revolist/revogrid-pro/vue | vue ^3.5.0 and @revolist/vue3-datagrid ^4.32.5 |
@revolist/revogrid-pro/react | react >=18 and @revolist/react-datagrid ^4.32.5 |
@revolist/revogrid-pro/angular | @angular/core and @angular/common >=22.2.0, and @revolist/angular-datagrid ^4.32.5 |
The main Pro package installs @revolist/revogrid as a dependency. You do not need the other frameworks to use one adapter.
<script setup lang="ts">import '@revolist/revogrid-pro/styles.css';import { HistoryPlugin } from '@revolist/revogrid-pro';import { VGrid } from '@revolist/vue3-datagrid';import { GridControlsProvider, HistoryControls,} from '@revolist/revogrid-pro/vue';
const plugins = [HistoryPlugin];const columns = [{ prop: 'name', name: 'Name' }];const rows = [{ name: 'Anna' }, { name: 'Ben' }];</script>
<template> <GridControlsProvider> <HistoryControls /> <VGrid style="height: 240px" :plugins="plugins" :columns="columns" :source="rows" /> </GridControlsProvider></template>Use .prop for plugin-defined grid properties as you would with VGrid.
import '@revolist/revogrid-pro/styles.css';import { HistoryPlugin } from '@revolist/revogrid-pro';import { RevoGrid } from '@revolist/react-datagrid';import { GridControlsProvider, HistoryControls,} from '@revolist/revogrid-pro/react';
const plugins = [HistoryPlugin];const columns = [{ prop: 'name', name: 'Name' }];const rows = [{ name: 'Anna' }, { name: 'Ben' }];
export function GridExample() { return ( <GridControlsProvider> <HistoryControls /> <RevoGrid style={{ height: 240 }} plugins={plugins} columns={columns} source={rows} /> </GridControlsProvider> );}Use the regular React RevoGrid and its usual props, events and ref.
import { Component } from '@angular/core';import { RevoGrid } from '@revolist/angular-datagrid';import { HistoryPlugin } from '@revolist/revogrid-pro';import { GridControlsProvider, HistoryControls,} from '@revolist/revogrid-pro/angular';
@Component({ standalone: true, imports: [RevoGrid, GridControlsProvider, HistoryControls], template: ` <revo-grid-controls-provider> <revo-history-controls /> <revo-grid style="height: 240px" [plugins]="plugins" [columns]="columns" [source]="rows" /> </revo-grid-controls-provider> `,})export class GridExample { plugins = [HistoryPlugin]; columns = [{ prop: 'name', name: 'Name' }]; rows = [{ name: 'Anna' }, { name: 'Ben' }];}Import the Pro stylesheet in your application’s global styles. The provider discovers the projected Angular RevoGrid; no grid reference or directive is needed.
Other grid controls
Section titled “Other grid controls”The same provider connects other grid controls. Add the matching plugin to your grid’s plugins array and import the control from your framework entry.
| Control | Required plugin | Configuration |
|---|---|---|
BatchEditingControls | BatchEditingPlugin | Optional translations for labels and messages. |
BatchBulkUpdateControls | BatchEditingPlugin | options with the fields to update and optional labels. |
RemoteGridExportControls | RemoteGridExportPlugin | Optional export options and translations. |
GridConfigurator | Installed automatically if needed | Optional configurator options. |
ViewSwitcherControls | ViewSwitcherPlugin | Optional labels and translations in options. |
AiAssistantControls | AiAssistantPlugin | Configure grid.aiAssistant with mountTo: false; optional surface options. |
FilterAstEditor | AdvanceFilterPlugin | Optional editor options and a reset handle. |
AuditHistoryPanel | AuditHistoryPlugin | Optional panel options and a handle for placement and refresh. |
FormulaNameManager | NamedRangesPlugin | Optional options, such as pageSize. |
FormulaBar | FormulaBarPlugin | Optional options for its adaptive controls. |
SmartPanel | SmartPanelPlugin | Configure panel items and labels on grid.smartPanel. |
WorkbookSheetTabs | WorkbookEditingPlugin | Place worksheet tabs for the open workbook. |
InfoPanel | InfoPanelPlugin | Show details of the selected row. |
FilterBadges | AdvanceFilterPlugin | Optional options for captions, labels, and badge rendering. |
PaginationControls | PaginationPlugin | Configure pages and translated labels on grid.pagination. |
FormattingToolbar | DataGridFormattingPanelPlugin | Configure formatting and labels on the grid. |
ColumnGroupPanel | ColumnGroupPanelPlugin | Configure grouping and the empty-panel text on the grid. |
GridStatusLine | GridStatusLinePlugin | Set grid.gridStatusLine before the grid initializes. |
GridFindControls | GridFindPlugin | Configure find and replace on grid.gridFind. The toolbar opens with the grid’s find shortcut or the plugin’s open() method. |
The scoped grid controls demo shows filter badges, a formatting toolbar, grouping, status, and pagination together. Each control follows the provider’s grid and accepts an optional grid input. When removed, it returns to its original grid placement and retains the plugin’s state.
<script setup lang="ts">import { GridControlsProvider, FilterBadges, FormattingToolbar, ColumnGroupPanel, GridStatusLine, PaginationControls } from '@revolist/revogrid-pro/vue';</script><template> <GridControlsProvider> <FilterBadges /> <FormattingToolbar /> <ColumnGroupPanel /> <VGrid :plugins="plugins" :columns="columns" :source="rows" /> <GridStatusLine /> <PaginationControls /> </GridControlsProvider></template>import { GridControlsProvider, FilterBadges, FormattingToolbar, ColumnGroupPanel, GridStatusLine, PaginationControls } from '@revolist/revogrid-pro/react';<GridControlsProvider> <FilterBadges /> <FormattingToolbar /> <ColumnGroupPanel /> <RevoGrid plugins={plugins} columns={columns} source={rows} /> <GridStatusLine /> <PaginationControls /></GridControlsProvider>import { GridControlsProvider, FilterBadges, FormattingToolbar, ColumnGroupPanel, GridStatusLine, PaginationControls } from '@revolist/revogrid-pro/angular';// Add these standalone components to imports.<revo-grid-controls-provider> <revo-filter-badges /> <revo-formatting-toolbar /> <revo-column-group-panel /> <revo-grid [plugins]="plugins" [columns]="columns" [source]="rows" /> <revo-grid-status-line /> <revo-pagination-controls /></revo-grid-controls-provider>Angular uses the corresponding element names, such as revo-batch-editing-controls, revo-grid-configurator, revo-filter-ast-editor, and revo-formula-bar. Add each standalone component to your component’s imports.
For example, in Vue:
<GridControlsProvider> <BatchEditingControls /> <BatchBulkUpdateControls :options="bulkOptions" /> <VGrid :plugins="[BatchEditingPlugin]" :columns="columns" :source="rows" /></GridControlsProvider>Define bulkOptions.fields with the column properties and labels to offer. The control connects after the grid is ready. Replacing options or translations reconnects the control; for bulk updates and filter editors this resets any unfinished form values. Keep these objects stable between renders when they have not changed.
Reset a filter or refresh an audit panel
Section titled “Reset a filter or refresh an audit panel”FilterAstEditor and AuditHistoryPanel accept an optional handle object. Its current property is set when the control connects and cleared when it disconnects. The framework owns teardown; use the exposed methods to reset the filter draft or change the audit panel placement and refresh it.
<script setup lang="ts">import { shallowReactive } from 'vue';import { FilterAstEditor, type ControlHandle, type FilterEditorHandle } from '@revolist/revogrid-pro/vue';const filterHandle = shallowReactive<ControlHandle<FilterEditorHandle>>({ current: null });function resetFilterDraft() { filterHandle.current?.reset(); }</script><template> <FilterAstEditor :handle="filterHandle" /> <button @click="resetFilterDraft">Reset draft</button></template>import { useRef } from 'react';import { FilterAstEditor, type FilterEditorHandle } from '@revolist/revogrid-pro/react';function FilterControls() { const filterHandle = useRef<FilterEditorHandle | null>(null); return <> <FilterAstEditor handle={filterHandle} /> <button onClick={() => filterHandle.current?.reset()}>Reset draft</button> </>;}import { FilterAstEditor, type ControlHandle, type FilterEditorHandle } from '@revolist/revogrid-pro/angular';// Include FilterAstEditor in the component's imports.filterHandle: ControlHandle<FilterEditorHandle> = { current: null };<revo-filter-ast-editor [handle]="filterHandle" /><button (click)="filterHandle.current?.reset()">Reset draft</button>For audit history, use ControlHandle<AuditPanelHandle> and call current?.refresh() or current?.setPlacement('right'). Keep the handle object and options stable to avoid remounting the control.
Build a framework component
Section titled “Build a framework component”Custom components can read the same scoped grid as the built-in controls. The value is null until the grid is ready and when it is removed; it changes when the grid is replaced. Each component reads the nearest provider. Subscribe to grid events in your framework’s lifecycle and remove those listeners when the grid changes or the component is destroyed.
import { useEffect } from 'react';import { useGridControls } from '@revolist/revogrid-pro/react';
function MyControl() { const grid = useGridControls(); useEffect(() => { if (!grid) return; const onChange = () => console.log('Grid data changed'); grid.addEventListener('afteredit', onChange); return () => grid.removeEventListener('afteredit', onChange); }, [grid]); return <button disabled={!grid}>My control</button>;}<script setup lang="ts">import { watch } from 'vue';import { useGridControls } from '@revolist/revogrid-pro/vue';
const grid = useGridControls(); // readonly refwatch( grid, (current, _previous, onCleanup) => { if (!current) return; const onChange = () => console.log('Grid data changed'); current.addEventListener('afteredit', onChange); onCleanup(() => current.removeEventListener('afteredit', onChange)); }, { immediate: true },);</script>
<template><button :disabled="!grid">My control</button></template>import { Component, inject, OnDestroy, signal } from '@angular/core';import { GridControlsScope } from '@revolist/revogrid-pro/angular';
@Component({ selector: 'my-control', standalone: true, template: '<button [disabled]="!grid()">My control</button>',})export class MyControl implements OnDestroy { private readonly scope = inject(GridControlsScope); readonly grid = signal(this.scope.grid); private readonly unsubscribe = this.scope.subscribe(() => this.grid.set(this.scope.grid), );
ngOnDestroy() { this.unsubscribe(); }}Place the custom component inside GridControlsProvider alongside the grid. Outside a provider, the React and Vue accessors return null; Angular injection requires a provider unless declared optional.
Connect another control
Section titled “Connect another control”Use GridControl for a control from another package or your application. Its mount function receives the host, the current grid, and an AbortSignal. Return a cleanup function or an object with destroy(); asynchronous mounts should also observe the signal. The provider calls cleanup when the grid or control goes away.
For the Gantt toolbar, use the component from the Gantt package inside the same provider as the grid:
<script setup lang="ts">import { GanttToolbar } from '@revolist/gantt/vue';</script>
<template> <GridControlsProvider> <GanttToolbar /> <VGrid :plugins="plugins" :columns="columns" :source="rows" /> </GridControlsProvider></template>import { GanttToolbar } from '@revolist/gantt/react';
<GridControlsProvider> <GanttToolbar /> <RevoGrid plugins={plugins} columns={columns} source={rows} /></GridControlsProvider>import { GanttToolbar } from '@revolist/gantt/angular';// Add GanttToolbar to your standalone component's imports.<revo-grid-controls-provider> <revo-gantt-toolbar /> <revo-grid [plugins]="plugins" [columns]="columns" [source]="rows" /></revo-grid-controls-provider>Configure your grid with the Gantt plugin as usual. The toolbar accepts options for its existing settings and DOM renderer slots, and an optional grid input to override the provider. Keep the options object stable to avoid remounting it.
Pivot configurator
Section titled “Pivot configurator”The Pivot configurator can follow the grid in the same provider. Configure the grid with PivotPlugin and your normal Pivot configuration; the component displays and updates that grid’s live configuration.
<script setup lang="ts">import { PivotConfigurator } from '@revolist/pivot/vue';</script>
<template> <GridControlsProvider> <PivotConfigurator /> <VGrid :plugins="plugins" :pivot.prop="pivot" :source="rows" /> </GridControlsProvider></template>import { PivotConfigurator } from '@revolist/pivot/react';
<GridControlsProvider> <PivotConfigurator /> <RevoGrid plugins={plugins} pivot={pivot} source={rows} /></GridControlsProvider>import { PivotConfigurator } from '@revolist/pivot/angular';// Add PivotConfigurator to your standalone component's imports.// Add NO_ERRORS_SCHEMA to its schemas for the plugin-defined pivot property.<revo-grid-controls-provider> <revo-pivot-configurator /> <revo-grid [plugins]="plugins" [pivot]="pivot" [source]="rows" /></revo-grid-controls-provider>The optional grid input overrides the provider. If you remove the component, the Pivot configuration determines whether the configurator stays visible and where it appears.
Pivot field panel
Section titled “Pivot field panel”Place PivotFieldPanel inside the same provider as a grid with PivotPlugin. It shows the compact field controls and follows the grid’s live Pivot configuration. Removing it restores the placement and visibility configured on the grid.
<script setup lang="ts">import { PivotFieldPanel } from '@revolist/pivot/vue';</script><template> <GridControlsProvider> <PivotFieldPanel /> <VGrid :plugins="plugins" :pivot.prop="pivot" :source="rows" /> </GridControlsProvider></template>import { PivotFieldPanel } from '@revolist/pivot/react';<GridControlsProvider> <PivotFieldPanel /> <RevoGrid plugins={plugins} pivot={pivot} source={rows} /></GridControlsProvider>import { PivotFieldPanel } from '@revolist/pivot/angular';// Add PivotFieldPanel to imports and NO_ERRORS_SCHEMA to schemas.<revo-grid-controls-provider> <revo-pivot-field-panel /> <revo-grid [plugins]="plugins" [pivot]="pivot" [source]="rows" /></revo-grid-controls-provider>Workbook tabs and row information
Section titled “Workbook tabs and row information”Add WorkbookEditingPlugin for worksheet tabs and InfoPanelPlugin for selected-row details. The tabs appear after opening a workbook; see editing an XLSX workbook for the ExcelJS setup. The info panel follows the selected grid row. You can use either control independently.
<script setup lang="ts">import { GridControlsProvider, WorkbookSheetTabs, InfoPanel } from '@revolist/revogrid-pro/vue';</script><template> <GridControlsProvider> <WorkbookSheetTabs /> <InfoPanel /> <VGrid :plugins="plugins" /> </GridControlsProvider></template>import { GridControlsProvider, WorkbookSheetTabs, InfoPanel } from '@revolist/revogrid-pro/react';<GridControlsProvider> <WorkbookSheetTabs /> <InfoPanel /> <RevoGrid plugins={plugins} /></GridControlsProvider>import { GridControlsProvider, WorkbookSheetTabs, InfoPanel } from '@revolist/revogrid-pro/angular';// Add the components to your standalone component's imports.<revo-grid-controls-provider> <revo-workbook-sheet-tabs /> <revo-info-panel /> <revo-grid [plugins]="plugins" /></revo-grid-controls-provider>All three controls accept an optional grid input. It overrides the provider when supplied. Workbook tabs return to the application’s configured tabsHost when the component is removed; the Pivot and info panels also return to their prior locations.
Pivot summary and chart
Section titled “Pivot summary and chart”Show the current Pivot layout and a linked chart alongside the grid. Add PivotSummaryPanelPlugin and PivotChartsPlugin to the grid’s plugins, and configure pivotCharts with a chart renderer. The summary follows the committed Pivot layout; the chart updates as the Pivot data changes.
<script setup lang="ts">import { GridControlsProvider } from '@revolist/revogrid-pro/vue';import { PivotChart, PivotSummaryPanel } from '@revolist/pivot/vue';</script>
<template> <GridControlsProvider> <PivotSummaryPanel /> <VGrid :plugins="plugins" :pivot.prop="pivot" :pivot-charts.prop="pivotCharts" :source="rows" /> <PivotChart /> </GridControlsProvider></template>import { GridControlsProvider } from '@revolist/revogrid-pro/react';import { PivotChart, PivotSummaryPanel } from '@revolist/pivot/react';
<GridControlsProvider> <PivotSummaryPanel /> <RevoGrid plugins={plugins} pivot={pivot} pivotCharts={pivotCharts} source={rows} /> <PivotChart /></GridControlsProvider>import { GridControlsProvider } from '@revolist/revogrid-pro/angular';import { PivotChart, PivotSummaryPanel } from '@revolist/pivot/angular';// Add these components to imports and NO_ERRORS_SCHEMA to schemas.<revo-grid-controls-provider> <revo-pivot-summary-panel /> <revo-grid [plugins]="plugins" [pivot]="pivot" [pivotCharts]="pivotCharts" [source]="rows" /> <revo-pivot-chart /></revo-grid-controls-provider>Use PivotChart’s options input to configure the chart, including controls: 'standard' when PivotChartsUiPlugin is installed. Keep options stable to avoid recreating the chart. An optional handle object with a current property exposes the chart while mounted; it becomes null on cleanup. Both components accept an explicit grid input.
The Pro PivotSummaryPanel framework component can also show an application-provided presentationSource. Use the Pivot package component above when the panel should follow a PivotPlugin automatically.
Supply a grid explicitly
Section titled “Supply a grid explicitly”A control can receive the actual HTMLRevoGridElement through its grid input, including when the control lives outside a provider. This input takes precedence over the scope:
| Input value | Behavior |
|---|---|
| Grid element | Connect to this grid, even inside a provider. |
null | Disconnect the control. |
undefined or omitted | Use the nearest provider, if available. |
<HistoryControls :grid="gridElement" /><HistoryControls grid={gridElement} /><revo-history-controls [grid]="gridElement" />Use a reactive value for gridElement so the framework sees replacements. React’s grid wrapper forwards the DOM element through its ref; a callback ref backed by state updates the control when it changes. Vue’s VGrid is an async component wrapper, and Angular’s RevoGrid component keeps its element protected. In those frameworks, the grid’s aftergridinit event exposes the element as event.target. If a grid is removed while an explicitly connected control remains, set the input to null.
Vanilla TypeScript
Section titled “Vanilla TypeScript”The existing imperative API remains available. Mount once the grid is ready and call the returned disposer when the toolbar or grid is replaced or removed:
import { defineHistoryControls } from '@revolist/revogrid-pro';
// The grid already has HistoryPlugin installed and has initialized.const dispose = defineHistoryControls(toolbarElement, gridElement);
// During application teardown:dispose();For a complete example with setup and cleanup, open Source code in the demo above and select TypeScript.
Related guides
Section titled “Related guides”- History Undo/Redo explains the plugin and history behavior.
- Data Synchronization explains the store and filter used in the live example.
- Revo UI covers independent UI components, including its existing framework Dropdown adapters.