Skip to content

Odd Rows

Apply different styles to odd rows for better readability and data distinction with the help of the RowOddPlugin.

Source code
import { defineCustomElements } from '@revolist/revogrid/loader';
import { RowOddPlugin } from '@revolist/revogrid-pro';
import { useRandomData, currentTheme } from '../composables/useRandomData';
defineCustomElements();
export function load(parentSelector: string) {
const grid = document.createElement('revo-grid');
const { createRandomData } = useRandomData();
const { isDark } = currentTheme();
grid.source = createRandomData(100);
grid.columns = [
{ name: '🆔 ID', prop: 'id' },
{ name: '🍎 Fruit', prop: 'name', size: 350 },
{ name: '💰 Price', prop: 'price' },
];
grid.plugins = [RowOddPlugin];
grid.theme = isDark() ? 'darkCompact' : 'compact';
grid.hideAttribution = true;
document.querySelector(parentSelector)?.appendChild(grid);
}