Skip to content

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();
};
}

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.

Explicit grid input

Overrides the scope; null disconnects the control.

Automatic cleanup

Grid replacement or removal releases the old connection.

One provider connects controls to one grid. For independent grids, use separate or nested providers.
  1. Add your normal grid component and controls inside the provider.
  2. The provider connects the controls when the grid is ready. History Controls then follow the grid’s history.
  3. 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.

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:

AdapterRequired packages
@revolist/revogrid-pro/vuevue ^3.5.0 and @revolist/vue3-datagrid ^4.32.5
@revolist/revogrid-pro/reactreact >=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.

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.

ControlRequired pluginConfiguration
BatchEditingControlsBatchEditingPluginOptional translations for labels and messages.
BatchBulkUpdateControlsBatchEditingPluginoptions with the fields to update and optional labels.
RemoteGridExportControlsRemoteGridExportPluginOptional export options and translations.
GridConfiguratorInstalled automatically if neededOptional configurator options.
ViewSwitcherControlsViewSwitcherPluginOptional labels and translations in options.
AiAssistantControlsAiAssistantPluginConfigure grid.aiAssistant with mountTo: false; optional surface options.
FilterAstEditorAdvanceFilterPluginOptional editor options and a reset handle.
AuditHistoryPanelAuditHistoryPluginOptional panel options and a handle for placement and refresh.
FormulaNameManagerNamedRangesPluginOptional options, such as pageSize.
FormulaBarFormulaBarPluginOptional options for its adaptive controls.
SmartPanelSmartPanelPluginConfigure panel items and labels on grid.smartPanel.
WorkbookSheetTabsWorkbookEditingPluginPlace worksheet tabs for the open workbook.
InfoPanelInfoPanelPluginShow details of the selected row.
FilterBadgesAdvanceFilterPluginOptional options for captions, labels, and badge rendering.
PaginationControlsPaginationPluginConfigure pages and translated labels on grid.pagination.
FormattingToolbarDataGridFormattingPanelPluginConfigure formatting and labels on the grid.
ColumnGroupPanelColumnGroupPanelPluginConfigure grouping and the empty-panel text on the grid.
GridStatusLineGridStatusLinePluginSet grid.gridStatusLine before the grid initializes.
GridFindControlsGridFindPluginConfigure 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>

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.

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>

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.

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>;
}

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.

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>

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.

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>

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.

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>

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>

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.

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>

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.

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 valueBehavior
Grid elementConnect to this grid, even inside a provider.
nullDisconnect the control.
undefined or omittedUse 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.

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.

  • 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.