Skip to content

Filter Header

The Filter Header Plugin enhances RevoGrid by embedding interactive filter controls directly within the column headers.

Source code
src/components/filter-slider/FilterAdvanced.ts
import { defineCustomElements } from '@revolist/revogrid/loader';
import { AdvanceFilterPlugin, ColumnStretchPlugin, FilterHeaderPlugin } from '@revolist/revogrid-pro';
defineCustomElements();
import { currentTheme, useRandomData } from '../composables/useRandomData';
const { createRandomData } = useRandomData();
const { isDark } = currentTheme();
export function load(parentSelector: string) {
const grid = document.createElement('revo-grid');
grid.source = createRandomData(100);
grid.columns = [
{
name: 'πŸ†” ID',
prop: 'id',
filter: ['number', 'slider']
},
{
name: '🍎 Fruit',
prop: 'name',
},
];
// Define plugin
grid.plugins = [AdvanceFilterPlugin, ColumnStretchPlugin, FilterHeaderPlugin];
grid.additionalData = {
stretch: 'all'
};
grid.filter = {};
grid.theme = isDark() ? 'darkCompact' : 'compact';
grid.hideAttribution = true;
document.querySelector(parentSelector)?.appendChild(grid);
}

This means that users can apply text-based and selection-based filters right at the grid level, without needing separate filter panels.

This feature allows for complex multi-criteria filtering that is both intuitive and highly efficient.

What makes this so powerful - is its ability to wrap existing header content with dynamic filter inputs, ensuring that the grid remains clean and user-friendly while offering robust filtering capabilities. With optimized performance through input debouncing, the Filter Header Plugin significantly improves data exploration, making it an essential tool for managing and analyzing large datasets.

Usage

To enable this powerful filtering capability, you simply need to include the FilterHeaderPlugin in your grid’s plugins array.

import { AdvanceFilterPlugin, FilterHeaderPlugin } from '@revolist/revogrid-pro'
const plugins = ref([AdvanceFilterPlugin, FilterHeaderPlugin])

This plugin automatically integrates filter input elements into your column headers, so when you mark a column with a filter property, it dynamically adds a text input or selection control right below the header.