Lattice Grid Buy a licence

The grid (core) ยท console.warn

grouping by {cols} produced {g} groups for {n} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.

Printed by The grid (core), prefixed [lattice], since 1.0.1.

Warnings referencegrouping.cardinality:*

Identifier
grouping.cardinality:*
Raised by
The grid (core)
Since
1.0.1

What happened

The grouping produced almost as many groups as there are rows, which is what happens when a continuous value - a price, a percentage, a timestamp - is used as a grouping key. Nothing is wrong and nothing was refused: the grid grouped exactly as asked, and the result is a tree that is no more readable than the flat rows and considerably slower to draw. Only checked above a hundred rows, so a small grid is never accused.

The fix

Group by a column that bands the value - a computed column that rounds, buckets or names a range - and keep the continuous column for sorting and aggregation.

The smallest fix

columns: [{ id: 'band', value: { deps: ['amount'], get: (p) => Math.floor(p.data.amount / 1000) * 1000 } }]

Reference

Covered in full at the API reference.