WarUI documentation

Server-driven total count

experimental

Size the scrollbar from a server-reported total that is exact, estimated or unknown.

Live example

Expected behavior

With an exact count, dragging to 50% requests a window near row 600,000. An estimate shows ~1.1M and adjusts once the real end is found. Unknown grows as data arrives. Adding rows updates the count without moving the top row.

Source

const api = createGrid({
  rows: [],
  columns,
  rowModel: 'remote',
  remoteSource: {
    async fetchWindow({ startIndex, endIndex, signal }) {
      const res = await fetch(`/audit?from=${startIndex}&to=${endIndex}`, { signal });
      const { rows, total } = await res.json();
      return { rows, totalCount: total, countKind: 'exact' };
    },
  },
});
api.on('totalCountChanged', ({ previous, next }) => update(previous, next));
grid.setAttribute('aria-rowcount', String(ariaRowCount(api.getTotalCount(), api.getCountKind())));

API reference

GRID-A04-F02 API
KindNameTypeDescription
PropertyWindowResult.countKind—'exact', 'estimate' or 'unknown'.
MethodgetTotalCount—The reported total, or undefined while unknown.
EventtotalCountChanged—Reports the previous and next count.
OptionmaxVirtualHeightStrategy—'scale' compresses huge heights, 'clamp' cuts them.