Lattice Grid Buy a licence

demo D187

Marking a baseline in Web Component

"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…

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.108.0/lattice-grid.min.css">

<script type="module">
  import { defineLatticeGrid } from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/modules/webcomponent.esm.min.js';
  defineLatticeGrid();
</script>

<button id="mark">Mark all</button>
<lattice-grid row-key="id" style="display: block; height: 440px; margin-top: 8px"></lattice-grid>

<script type="module">
  const el = document.querySelector('lattice-grid');
  el.config = {
    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' },
    ],
  };
  el.rows = rows;  // trading book records

  // rebase moves every baseline to the current value, so the deltas start again.
  // el.grid is the live grid inside the element.
  document.getElementById('mark').onclick = () => el.grid.statistics.rebase('price');
</script>