demo D207
Every type
A column per type, from every group, each sorting on its value not its text
type: 'voltage' · 'bytes' · 'ipv4' · …
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/lattice-grid.min.css">
<div id="grid" style="height: 540px"></div>
<script type="module">
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/modules/htmx.esm.js';
// One column per built-in type, from every group. Each stores a number and
// sorts on it rather than on the text it shows, and brings its own parser,
// alignment and filter.
const grid = createGrid(document.getElementById('grid'), {
rowKey: 'id',
toolPanel: { side: 'left', panels: ['columns', 'filters'], exportName: 'types' },
columns: [
{ field: 'label', title: 'Sample', layout: { pin: 'start', width: 130 } },
{ field: 'address', title: 'ipv4', type: 'ipv4', layout: { width: 140 } },
{ field: 'subnet', title: 'cidr', type: 'cidr', layout: { width: 150 } },
{ field: 'elapsed', title: 'duration', type: 'duration', layout: { width: 130 } },
{ field: 'disk', title: 'bytes', type: 'bytes', layout: { width: 120 } },
{ field: 'link', title: 'bitrate', type: 'bitrate', layout: { width: 120 } },
{ field: 'status', title: 'hex', type: 'hex', layout: { width: 110 } },
{ field: 'temp', title: 'celsius', type: 'celsius', layout: { width: 110 } },
{ field: 'voltage', title: 'voltage', type: 'voltage', layout: { width: 120 } },
{ field: 'resistance', title: 'resistance', type: 'resistance', layout: { width: 130 } },
{ field: 'frequency', title: 'frequency', type: 'frequency', layout: { width: 130 } },
{ field: 'pressure', title: 'pressure', type: 'pressure', layout: { width: 130 } },
{ field: 'spindle', title: 'rpm', type: 'rpm', layout: { width: 120 } },
{ field: 'span', title: 'metres', type: 'metres', layout: { width: 120 } },
{ field: 'mass', title: 'kilograms', type: 'kilograms', layout: { width: 130 } },
{ field: 'cpu', title: 'percentRate', type: 'percentRate', layout: { width: 130 } },
{ field: 'spread', title: 'basisPoints', type: 'basisPoints', layout: { width: 130 } },
],
rows, // a deterministic sample set, one value per typed column
});
</script>