Capítulo 50 de 54

Chapter 50: Row Model Factories

Core Idea

Every create*RowModel() factory referenced throughout the Row Models Guide and the feature guides has the same shape — a zero/options-arg function you register on a tableFeatures() slot — and this chapter is the flat reference for all seven plus the row/row-model types they operate on.

Key Concepts

  • Row<TFeatures, TData>: the instance type from any row model's .rows (Rows Guide). RowData: the base constraint every row-shape generic (TData) extends. RowModel<TFeatures, TData>: the { rows, flatRows, rowsById } shape every row-model getter returns (Row Models Guide). RowModelFns<TFeatures, TData>: the slot type for a row-model factory function inside tableFeatures(). CachedRowModels<TFeatures, TData>: the internal cache structure backing memoized row-model computation.
  • The seven create*RowModel factories, one per pipeline stage: createCoreRowModel() (automatic, rarely registered explicitly), createFilteredRowModel(), createSortedRowModel(), createGroupedRowModel(), createExpandedRowModel(), createPaginatedRowModel(), plus the faceting trio createFacetedRowModel()/createFacetedMinMaxValues()/createFacetedUniqueValues() (technically three more, all under the same factory pattern) — see the Row Models Guide's slot table for which feature each pairs with.
  • constructRow(...): the internal-facing row constructor (same family as constructTable/constructColumn/constructCell/constructHeader) — the low-level object builder every adapter calls, not typically invoked directly by app code.
  • expandRows(...): the internal function that flattens a grouped/nested row tree into the flat + tree views a row model exposes — what getExpandedRowModel/table.getRowModel().flatRows ultimately rely on.

Reference Tables

FactoryRegisters asFeature it pairs with
createCoreRowModel()(automatic)none — always included
createFilteredRowModel()filteredRowModelcolumnFilteringFeature
createSortedRowModel()sortedRowModelrowSortingFeature
createGroupedRowModel()groupedRowModelcolumnGroupingFeature
createExpandedRowModel()expandedRowModelrowExpandingFeature
createPaginatedRowModel()paginatedRowModelrowPaginationFeature
createFacetedRowModel()facetedRowModelcolumnFacetingFeature
createFacetedMinMaxValues()facetedMinMaxValuescolumnFacetingFeature
createFacetedUniqueValues()facetedUniqueValuescolumnFacetingFeature

Key Takeaways

  1. Every factory here is called with no arguments (or, for faceting, sometimes a custom implementation per the Faceting Guide's server-side pattern) and assigned directly to its named slot in tableFeatures().
  2. Registering the feature without the matching factory (or vice versa) is a type error by design — tableFeatures() validates the pairing (see Features Guide).
  3. constructRow/expandRows are internals worth knowing about for debugging row-model behavior, not APIs typical app code calls.

Connects To

  • Row Models Guide: the full pipeline order and slot table this chapter tabulates.
  • Faceting Guide: custom facetedUniqueValues/facetedMinMaxValues factories for server-side faceting.
  • Rows Guide: Row instance properties/methods in practical use.