Lattice Grid Buy a licence

demo D187

Marking a baseline: JavaScript Data Grid Demo

"Mark all" resets every delta to now

grid.statistics.rebase(col)

This grid resets every delta to now with a single 'mark all', setting a fresh baseline. It lets a reader say 'watch from here', so change tracking restarts from the current moment rather than page load.

Building…
Loading a live grid…

The configuration

<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.103.2/lattice-grid.min.css">
<script src="https://cdn.latticegrid.dev/lattice-grid@1.103.2/lattice-grid.min.js"></script>

<button id="mark">Mark all</button>
<div id="grid" style="height: 440px; margin-top: 8px"></div>

<script>
  const grid = LatticeGrid.createGrid(document.getElementById('grid'), {
    rowKey: 'id',
    columns: [
      { field: 'symbol', title: 'Symbol', layout: { pin: 'start', width: 120 } },
      { field: 'price', title: 'Price', type: 'number' },
      { id: 'delta', title: 'Change', shadow: { of: 'price', kind: 'delta' }, type: 'number', format: { signed: true } },
      { id: 'first', title: 'Baseline', shadow: { of: 'price', kind: 'firstValue' }, type: 'number' },
    ],
    rows,  // a live price book
  });

  // rebase moves every baseline to the current value, so the deltas start again.
  document.getElementById('mark').addEventListener('click', () => grid.statistics.rebase('price'));
</script>