Lattice Grid Buy a licence

demo D185

Shadow columns: rank and movement

Rank, percentile and places moved; sort by places moved for live top movers

shadow: { of, kind: 'rankChange' }

Building…
Loading a live grid…

The configuration

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/lattice-grid.min.css">

<div id="grid"></div>

<script type="module">
  import React from 'https://esm.sh/react@18';
  import { createRoot } from 'https://esm.sh/react-dom@18/client';
  import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/lattice-grid.esm.min.js';
  import createLatticeGrid from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/modules/react.esm.min.js';

  const LatticeGrid = createLatticeGrid({ React, createGrid });

  const columns = [
    { field: 'symbol', title: 'Symbol', layout: { pin: 'start', width: 120 } },
    { field: 'price', title: 'Price', type: 'number' },
    { id: 'rank',  title: 'Rank', shadow: { of: 'price', kind: 'rank' }, type: 'number' },
    // rankChange is places climbed since the baseline: the top-movers column.
    { id: 'moved', title: 'Places moved', shadow: { of: 'price', kind: 'rankChange' }, type: 'number', format: { signed: true } },
    { id: 'pct',   title: 'Percentile', shadow: { of: 'price', kind: 'percentile' }, type: 'number' },
  ];

  const rows = [/* a live price book */];

  function App() {
    return (
      <LatticeGrid
        rowKey="id"
        highlightOnChange={{ duration: 500 }}
        // Land sorted on the movers.
        state={{ sort: [{ col: 'moved', dir: 'desc' }] }}
        columns={columns}
        rows={rows}
        style={{ height: '460px' }}
      />
    );
  }

  createRoot(document.getElementById('grid')).render(<App />);
</script>