Skip to content

Same Value Merge

ColumnRegular (Extended from @revolist/revogrid)

Section titled “ColumnRegular (Extended from @revolist/revogrid)”
interface ColumnRegular {
/**
* Enables same-value merging for this column
*/
merge?: boolean
}

The SameValueMergePlugin is a RevoGrid plugin designed to merge cells with the same values in a column. It adds visual merge markers to cells that have the same value as the nearest comparable visible row above or below them.

Key Features:

  • Visible row comparison: Checks nearest comparable visible rows above and below the current cell
  • Grouping support: Group rows are comparable when they carry the current column value
  • Column Configuration: Supports a ‘merge’ property on columns to enable/disable merging
  • Visual Styling: Adds an auto-merge marker used by CSS to hide repeated values

Usage:

  • This plugin should be included in the grid’s plugin array to enable same-value merging functionality.
  • Configure columns with the ‘merge’ property to enable merging for specific columns.
import { SameValueMergePlugin } from './same-value-merge-plugin';
const grid = document.createElement('revo-grid');
grid.plugins = [SameValueMergePlugin]; // Add merge plugin
grid.columns = [
{ prop: 'name', name: 'Name' },
{ prop: 'category', name: 'Category', merge: true }, // Enable merging for this column
];
class SameValueMergePlugin {
destroy(): void;
}

export function isPivotGeneratedRow(model?: DataType);

export function isPivotTotalRow(model?: DataType);

export function hasPivotMergeBoundary(
items: number[],
visibleIndex: number,
source: DataType[],
currentModel: DataType | undefined,
prop: ColumnProp,
);