Skip to content

Same Value Merge

Module Extensions

ColumnRegular (Extended from @revolist/revogrid)

interface ColumnRegular {
/**
* Enables same-value merging for this column
*/
merge?: boolean
}

Plugin API

SameValueMergePlugin

The SameValueMergePlugin is a RevoGrid plugin designed to merge cells with the same values in a column. It adds a special class to cells that have the same value as the cell above them.

Key Features:

  • Simple implementation: Just checks if the current cell has the same value as the cell above it
  • Column Configuration: Supports a ‘merge’ property on columns to enable/disable merging
  • Visual Styling: Adds a class to cells with the same value as the cell above

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.

Example

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