demo D181
The statistics panel
The column profile as a docked tool panel, following the filters
toolPanel: { panels: ['statistics'] }
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.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.27.0/modules/htmx.esm.js';
const grid = createGrid(document.getElementById('grid'), {
rowKey: 'id',
// Add 'statistics' to the tool panel and open it on load: a live read-out of
// count, sum, mean, spread and more for every numeric column, following the
// filters as they change.
toolPanel: { side: 'left', panels: ['columns', 'filters', 'statistics'], openPanel: 'statistics' },
columnDefaults: { filter: true },
columns: [
{ field: 'symbol', title: 'Symbol', layout: { pin: 'start', width: 120 } },
{ field: 'desk', title: 'Desk', filter: { type: 'set' } },
{ field: 'price', title: 'Price', type: 'number' },
{ field: 'bid', title: 'Bid', type: 'number' },
{ field: 'volume', title: 'Volume', type: 'number' },
{ field: 'notional', title: 'Notional', type: 'number',
format: { style: 'currency', currency: 'USD' }, total: 'sum' },
],
rows, // e.g. [{ id: 1, symbol: 'ABC', desk: 'Rates', price: 101.2, bid: 101.1, volume: 4200, notional: 425040 }, …]
});
</script>