demo D179
Statistics in the totals row
Median, percentiles, deviation and spread, each over the filtered rows
total: 'median' · 'p95' · 'stddev'
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" style="height: 460px"></div>
<script type="module">
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/modules/htmx.esm.js';
const grid = createGrid(document.getElementById('grid'), {
rowKey: 'id',
columnDefaults: { filter: true },
columns: [
{ field: 'reference', title: 'Reference', layout: { pin: 'start', width: 150 } },
{ field: 'desk', title: 'Desk', filter: { type: 'set' } },
// Each column names its own reduction: median, 95th percentile, deviation.
{ field: 'price', title: 'Price', type: 'number', total: 'median' },
{ field: 'bid', title: 'Bid', type: 'number', total: 'p95' },
{ field: 'volume', title: 'Volume', type: 'number', total: 'iqr' },
{ field: 'notional', title: 'Notional', type: 'number', total: 'sum' },
],
rows, // trading book records
});
</script>