AG Grid on the striped savant theme: the 2025-26 NHL Atlantic Division, team-coloured rows over the stripes, rows selectable
| Team | W | L | OTL | Pts |
|---|---|---|---|---|
BUF | 50 | 23 | 9 | 109 |
TBL | 50 | 26 | 6 | 106 |
MTL | 48 | 24 | 10 | 106 |
BOS | 45 | 27 | 10 | 100 |
OTT | 44 | 27 | 11 | 99 |
DET | 41 | 31 | 10 | 92 |
FLA | 40 | 38 | 4 | 84 |
TOR | 32 | 36 | 14 | 78 |
import { NHL_STANDINGS } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { gridOptions } from "@sportsdataverse/sdvtables/aggrid";
import { fontsLinkFor, prepare, renderHTML } from "@sportsdataverse/sdvtables/html";
// the eight Atlantic rows, picked by team from the final 2025-26 standings
const spec = defineTable<(typeof NHL_STANDINGS)[number]>()
.columns((c) => [
c.logo("team", { league: "nhl", includeName: true, label: "Team", height: 24, width: "110px" }),
c.int("wins", { label: "W", width: "70px" }),
c.int("losses", { label: "L", width: "70px" }),
c.int("ot_losses", { label: "OTL", width: "70px" }),
c.int("points", { label: "Pts", width: "70px" }),
])
.theme("savant") // striped: odd rows are #F4F4F4, which a team row's own fill covers
.rowKey("team")
.build();
await prepare(spec);
// In the browser this page calls mount with ag-grid-community's module and the grid's element.
export const browser = {
lib: "ag-grid",
mount: (
{ AllCommunityModule, ModuleRegistry, createGrid, themeQuartz }: typeof import("ag-grid-community"),
el: HTMLElement,
) => {
ModuleRegistry.registerModules([AllCommunityModule]); // AG Grid Community: no enterprise module
document.head.insertAdjacentHTML("beforeend", fontsLinkFor(spec)); // the savant theme's fonts
return createGrid(el, {
...gridOptions(spec, NHL_STANDINGS, {
theme: themeQuartz,
teamRows: { key: "team", league: "nhl" },
}),
domLayout: "autoHeight",
// click a row to select it (AG Grid Community's row selection): it keeps a shade of its team's colour
rowSelection: { mode: "singleRow", checkboxes: false, enableClickSelection: true },
});
},
width: 480,
label:
"The 2025-26 NHL Atlantic Division standings as an AG Grid on the striped savant theme, one row per team in its team colour with its logo",
} as const;
// AG Grid draws only in a browser; without JavaScript the page shows the same table as sdvtables' HTML
renderHTML(spec, NHL_STANDINGS);
Tags: table · ag-grid · gridOptions · teamRows · logo · savant · nhl. All sdvtables examples.
BUF
TBL
MTL
BOS
OTT
DET
FLA
TOR