Fuaranfuaran

The source for generative UI

Windowed grids over large tables

A windowed grid presents the slice of rows its viewport can show, not every row, so scrolling a very large table costs one window and not the table. The document carries no scroll position, row height or viewport size: the grid names a State key, the renderer writes the window into it as the viewport moves, and the grid reads it back.

The two members

  • windowStateKey names the State key that holds the window, an object with an offset (the 0-based index of the first row) and a count. A value that is not usable (absent, the wrong shape, negative or fractional) is no window: the grid presents what it would have without the field, and no malformed value can hide a row.
  • rowTotal is a binding for the declared size of the whole result, for a grid whose host slices it. A value that is not an integer of zero or more means no declared total: the total is unknown, never guessed.

Who slices

The source shape decides, with no second declaration:

The grid's sourceThe host returnsThe grid slices
a query that depends on the window keythe windownothing; the total is rowTotal, or unknown
a query that depends on the page keythe pagethe window, within the page
anything elsethe whole setthe page, then the window

A client-sliced grid applies sort, then page, then window, so a window indexes the sorted and filtered set the reader sees. A window past the total presents the last full window rather than an empty grid. A host that windows a query applies the same order first, typically by appending a limit step after the pipeline's filter and sort steps.

The evidence

  • grid-windowed: a host-windowed query with its declared total.
  • grid-windowed-sorted: the client-sliced form under a sort.
  • The grid-window vectors: which rows a window presents at the start, middle and end, past the total, under a sort over a filtered set, within a page, for malformed descriptors and for both host-sliced shapes.
  • The format is specified in the wire format. Every host with a grid renderer runs the grid-window vectors through its own window function, and the .NET and TypeScript hosts also run the viewport writer's own vector family.

Back to Data in the interface.