demo D184
Shadow columns: what changed
Delta, percent change and a move count against the value at page load
shadow: { of, kind: 'delta' }
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 });
const columns = [
{ field: 'symbol', title: 'Symbol', layout: { pin: 'start', width: 120 } },
{ field: 'price', title: 'Price', type: 'number' },
// A shadow column is declared against another and maintained by the grid.
{ id: 'delta', title: 'Change', shadow: { of: 'price', kind: 'delta' }, type: 'number', format: { signed: true } },
{ id: 'pct', title: 'Change %', shadow: { of: 'price', kind: 'deltaPercent' }, type: 'number', format: { style: 'percent', signed: true } },
{ id: 'moves', title: 'Moves', shadow: { of: 'price', kind: 'updates' }, type: 'number' },
{ id: 'streak', title: 'Streak', shadow: { of: 'price', kind: 'streak' }, type: 'number', format: { signed: true } },
];
const rows = [/* a live price book */];
@Component({
selector: 'app-root',
standalone: true,
imports: [LatticeGridComponent],
template: '<lattice-grid [config]="grid" style="display:block;height:460px"></lattice-grid>',
})
export class AppComponent {
grid = {
rowKey: 'id',
highlightOnChange: { duration: 500 },
columns: columns,
rows: rows,
};
}
bootstrapApplication(AppComponent);