demo D207
Every type in Web Component
A column per type, from every group, each sorting on its value not its text
type: 'voltage' · 'bytes' · 'ipv4' · …
This grid lays out one column of every type the grid ships, across every group, each sorting on its real value rather than its text. It is the quick reference for what a type buys you, so you can see the whole set behaving correctly in one place.
This is the web component version. A lattice-grid custom element renders the grid with no build step, its configuration set as a property, so it works on a page that has no bundler at all.
The configuration
<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.107.0/lattice-grid.min.css">
<script type="module">
import { defineLatticeGrid } from 'https://cdn.latticegrid.dev/lattice-grid@1.107.0/modules/webcomponent.esm.min.js';
defineLatticeGrid();
</script>
<lattice-grid row-key="id" style="display: block; height: 500px"></lattice-grid>
<script type="module">
const grid = document.querySelector('lattice-grid');
grid.config = {
toolPanel: { side: 'left', panels: ['columns', 'filters'] },
// One column per built-in type. Each brings its own parser, comparator,
// editor, filter and alignment; each sorts on its stored value.
columns: [
{ field: 'label', title: 'Sample', layout: { pin: 'start', width: 130 } },
{ field: 'address', title: 'ipv4', type: 'ipv4' },
{ field: 'subnet', title: 'cidr', type: 'cidr' },
{ field: 'elapsed', title: 'duration', type: 'duration' },
{ field: 'disk', title: 'bytes', type: 'bytes' },
{ field: 'link', title: 'bitrate', type: 'bitrate' },
{ field: 'status', title: 'hex', type: 'hex' },
{ field: 'temp', title: 'celsius', type: 'celsius' },
{ field: 'voltage', title: 'voltage', type: 'voltage' },
{ field: 'resistance', title: 'resistance', type: 'resistance' },
{ field: 'frequency', title: 'frequency', type: 'frequency' },
{ field: 'pressure', title: 'pressure', type: 'pressure' },
{ field: 'spindle', title: 'rpm', type: 'rpm' },
],
};
grid.rows = rows;
</script>