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
import * as ng from '@angular/core';
import { Component } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import createLatticeGrid from '@toclocoinc/lattice-grid/modules/angular';
const { LatticeGridComponent } = createLatticeGrid({ ng, createGrid });
// 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);