demo D207
Every type in Angular
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 Angular version. A standalone component takes the whole configuration through one config input, surfaces grid events as outputs, and exposes the live grid on a getter for anything the inputs do not cover.
The configuration
import { Component } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import { LatticeGridComponent, provideLattice } from '@toclocoinc/lattice-grid/angular';
// One column per type, from every group. Each stores a number and sorts on
// it, not on the text it shows, and brings its own parser, alignment, editor
// and filter.
const 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 } },
];
const rows = [/* a sample row per record, one value per typed column */];
@Component({
selector: 'app-root',
standalone: true,
imports: [LatticeGridComponent],
template: '<lattice-grid [config]="grid" style="display:block;height:540px"></lattice-grid>',
})
export class AppComponent {
grid = {
rowKey: 'id',
toolPanel: { side: 'left', panels: ['columns', 'filters'], exportName: 'types' },
columns: columns,
rows: rows,
};
}
bootstrapApplication(AppComponent, {
providers: [provideLattice({ createGrid })],
});