Table
Generated from docs.json. 394 exposed values, types, and type aliases, in the order the module exposes them.
Headless table state and row-model pipeline: a port of TanStack Table core as pure functions.
There is no table instance. You own the State, you own the data, and every
function here takes a Config row and a State and gives you a value back.
Columns and headers
Column and header types, the builders that assemble a Config row's column
list, and the readers that walk it back.
Types
Column
type alias Column row =
Table.Column rowConfig
type alias Config row =
Table.Config rowEverything about a table that is not state: the columns, how to find row ids and sub-rows, and every feature flag.
It is a plain record, so { cfg | manualSorting = True } works for any flag
that has no builder. Later versions of this package may add fields, which is
a breaking change for code that pattern matches on the record but not for
record update.
Fields, with the defaults config sets:
columns : List (Column row)getRowId : Maybe (row -> Int -> Maybe String -> String),Nothing(index paths)getSubRows : row -> List row, nonemanualSorting,manualFiltering,manualGrouping,manualExpanding,manualPagination : Bool, allFalse;Truemakes that stage return its inputenableSorting,enableMultiSort,enableSortingRemoval,enableMultiRemove : Bool, allTrue;maxMultiSortColCount : Int, unlimited;sortDescFirst : Maybe Bool,Nothing(automatic per column)enableFilters,enableColumnFilters,enableGlobalFilter : Bool, allTrue;getColumnCanGlobalFilter : Maybe (Column row -> Bool),Nothing(strings and numbers);filterFromLeafRows : Bool,False;maxLeafRowFilterDepth : Int,100;globalFilterFn : Maybe FilterFn,Nothing(automatic)enableGrouping : Bool,True;groupedColumnMode : GroupedColumnMode,groupedColumnsReorderenableExpanding : Bool,True;getRowCanExpand,getIsRowExpanded : Maybe (Row row -> Bool),Nothing;paginateExpandedRows : Bool,TruepageCount,rowCount : Maybe Int,Nothing(manual pagination only)enableRowSelection,enableMultiRowSelection,enableSubRowSelection,enableRowPinning : Row row -> Bool, allalways True;keepPinnedRows : Bool,TrueenableColumnPinning,enableHiding : Bool,True;defaultColumn : SizeDefaults, size 150, min 20, max unlimitedenableCellSpanning,enableCellSelection,enableCellRangeSelection,enableMultiCellRangeSelection : Bool, allTrue;cellSelectionFilter : Maybe (Cell -> Bool),Nothing
State
type alias State =
Table.StateEvery state slice the pipeline reads. Start from
initialState and update it yourself, directly or through
the transition functions in this module.
sorting : List SortColumn, in priority ordercolumnFilters : List ColumnFilterglobalFilter : Value,Nullfor nonegrouping : List String, column ids in grouping orderexpanded : ExpandedrowSelection : Set String, selected row idspagination : PaginationcolumnOrder : List String, empty for definition ordercolumnVisibility : Dict String Bool, missing means visiblecolumnPinning : ColumnPinningcolumnSizing : Dict String Float, missing means the column's own sizerowPinning : RowPinningcellSelection : List CellSelectionRange
Row
type alias Row row =
Table.Row rowOne row of a row model.
RowModel
type alias RowModel row =
Table.RowModel rowThe output of a pipeline stage: the row tree, the same rows flattened depth first, and a lookup by row id.
Header
type alias Header row =
Table.Header rowOne header cell.
HeaderGroup
type alias HeaderGroup row =
Table.HeaderGroup rowOne header row.
Cell
type alias Cell =
Table.CellOne cell of one row, computed on demand.
Expanded
type alias Expanded =
Table.ExpandedWhich rows are expanded. ExpandAll is TanStack's expanded: true.
SortUndefined
type alias SortUndefined =
Table.SortUndefinedWhere Null values land when a column is sorted.
GroupedColumnMode
type alias GroupedColumnMode =
Table.GroupedColumnModeWhat the leaf column list does with grouped columns.
SortColumn
type alias SortColumn =
Table.SortColumnOne entry of State.sorting.
ColumnFilter
type alias ColumnFilter =
Table.ColumnFilterOne entry of State.columnFilters.
Pagination
type alias Pagination =
Table.PaginationThe page the paginated row model returns.
ColumnPinning
type alias ColumnPinning =
Table.ColumnPinningColumn ids pinned to either edge.
RowPinning
type alias RowPinning =
Table.RowPinningRow ids pinned to the top or the bottom.
SizeDefaults
type alias SizeDefaults =
Table.SizeDefaultsThe default sizing of a column, in pixels.
Elm cannot re-export the variants of a type that is declared in another module, so the three unions above are abstract here and come with one function per variant.
expandAll
expandAll : Table.ExpandedEvery row is expanded, whatever State.rowSelection holds. TanStack's
expanded: true.
expandedIds
expandedIds : Set String -> Table.ExpandedOnly the rows with these ids are expanded.
expandedIdsOf
expandedIdsOf : Table.Expanded -> Maybe (Set String)The expanded row ids, or Nothing when every row is expanded.
sortNullsFirst
sortNullsFirst : Table.SortUndefinedSort Null cell values before every other value.
sortNullsLast
sortNullsLast : Table.SortUndefinedSort Null cell values after every other value. This is the default.
sortNullsAsMinusOne
sortNullsAsMinusOne : Table.SortUndefinedSort Null cell values as if they compared -1 against anything else,
TanStack's sortUndefined: -1.
sortNullsAsPlusOne
sortNullsAsPlusOne : Table.SortUndefinedSort Null cell values as if they compared 1 against anything else,
TanStack's sortUndefined: 1.
groupedColumnsReorder
groupedColumnsReorder : Table.GroupedColumnModeMove grouped columns to the front of the leaf column list.
groupedColumnsRemove
groupedColumnsRemove : Table.GroupedColumnModeDrop grouped columns from the leaf column list.
groupedColumnsIgnore
groupedColumnsIgnore : Table.GroupedColumnModeLeave grouped columns where they are.
Configuration
config
config : List (Table.Column row) -> Table.Config rowA configuration for a list of columns, with TanStack's defaults for every flag.
config [ Table.column "firstName" (.firstName >> Value.String) ]
initialState
initialState : Table.StateThe state a table starts in: nothing sorted, nothing filtered, nothing grouped, page 0 of size 10.
withGetRowId
withGetRowId : (row -> Int -> Maybe String -> String) -> Table.Config row -> Table.Config rowGive rows stable ids. The function receives the datum, its index among its siblings, and its parent's row id.
Without it, root rows are "0", "1", and children are "0.1", "0.2".
withSubRows
withSubRows : (row -> List row) -> Table.Config row -> Table.Config rowTell the core row model how to reach a row's children.
withDefaultColumn
withDefaultColumn : Table.SizeDefaults -> Table.Config row -> Table.Config rowOverride the default column sizing (150, 20, 9007199254740991).
withGlobalFilterFn
withGlobalFilterFn : Table.FilterFn.FilterFn -> Table.Config row -> Table.Config rowSet the filter function the global filter uses.
withRowSelection
withRowSelection : (Table.Row row -> Bool) -> Table.Config row -> Table.Config rowDecide per row whether it can be selected.
Building columns
column
column : String -> (row -> Table.Value.Value) -> Table.Column rowAn accessor column: an id and a way to read a cell value.
Table.column "age" (.age >> toFloat >> Value.Number)
group
group : String -> List (Table.Column row) -> Table.Column rowA group column: an id and the columns nested under it. Group columns have no accessor and no cells, they only produce header rows.
display
display : String -> Table.Column rowA display column: an id, no accessor, no children.
withHeader
withHeader : String -> Table.Column row -> Table.Column rowSet the header text.
withSortFn
withSortFn : Table.SortFn.SortFn -> Table.Column row -> Table.Column rowSort this column with a built-in sort function.
withCustomSort
withCustomSort : (Table.Row row -> Table.Row row -> Order) -> Table.Column row -> Table.Column rowSort this column with a comparison on whole rows.
withSortDescFirst
withSortDescFirst : Bool -> Table.Column row -> Table.Column rowMake the first click on this column sort descending.
withInvertSorting
withInvertSorting : Bool -> Table.Column row -> Table.Column rowInvert the sort direction of this column.
withSortUndefined
withSortUndefined : Table.SortUndefined -> Table.Column row -> Table.Column rowDecide where Null values land when this column is sorted.
withEnableSorting
withEnableSorting : Bool -> Table.Column row -> Table.Column rowAllow or forbid sorting on this column.
withEnableMultiSort
withEnableMultiSort : Bool -> Table.Column row -> Table.Column rowAllow or forbid this column in a multi-sort.
withFilterFn
withFilterFn : Table.FilterFn.FilterFn -> Table.Column row -> Table.Column rowFilter this column with a built-in filter function.
withCustomFilter
withCustomFilter : (Table.Row row -> Table.Value.Value -> Bool) -> Table.Column row -> Table.Column rowFilter this column with a predicate on whole rows.
withEnableColumnFilter
withEnableColumnFilter : Bool -> Table.Column row -> Table.Column rowAllow or forbid a column filter on this column.
withEnableGlobalFilter
withEnableGlobalFilter : Bool -> Table.Column row -> Table.Column rowInclude or exclude this column from the global filter.
withAggregationFn
withAggregationFn : Table.AggregationFn.AggregationFn -> Table.Column row -> Table.Column rowAggregate this column's values on group rows.
withGetGroupingValue
withGetGroupingValue : (row -> Int -> Table.Value.Value) -> Table.Column row -> Table.Column rowRead the value this column groups by, when it differs from the accessor.
The second argument is the row's index, mirroring TanStack's
getGroupingValue(originalRow, index, row).
withGetUniqueValues
withGetUniqueValues : (row -> List Table.Value.Value) -> Table.Column row -> Table.Column rowRead the faceting values of a row, when one cell holds several.
withEnableGrouping
withEnableGrouping : Bool -> Table.Column row -> Table.Column rowAllow or forbid grouping by this column.
withEnableHiding
withEnableHiding : Bool -> Table.Column row -> Table.Column rowAllow or forbid hiding this column.
withEnablePinning
withEnablePinning : Bool -> Table.Column row -> Table.Column rowAllow or forbid pinning this column.
withSize
withSize : Float -> Table.Column row -> Table.Column rowSet this column's size in pixels.
withMinSize
withMinSize : Float -> Table.Column row -> Table.Column rowSet this column's minimum size in pixels.
withMaxSize
withMaxSize : Float -> Table.Column row -> Table.Column rowSet this column's maximum size in pixels.
Reading columns
columnId
columnId : Table.Column row -> StringThe column id.
columnHeader
columnHeader : Table.Column row -> Maybe StringThe header text, when one was set.
columnDepth
columnDepth : Table.Column row -> IntHow deep the column sits in the column tree. Top level is 0.
columnColumns
columnColumns : Table.Column row -> List (Table.Column row)The columns nested under a group column.
columnParentId
columnParentId : Table.Column row -> Maybe StringThe id of the group column this column sits under.
columnAccessor
columnAccessor : Table.Column row -> Maybe (row -> Table.Value.Value)The accessor, when the column has one. Group and display columns have none.
columnSize
columnSize : Table.Config row -> Table.Column row -> FloatThis column's size in pixels, clamped to its minimum and maximum.
columnMinSize
columnMinSize : Table.Config row -> Table.Column row -> FloatThis column's minimum size in pixels.
columnMaxSize
columnMaxSize : Table.Config row -> Table.Column row -> FloatThis column's maximum size in pixels.
allColumns
allColumns : Table.Config row -> List (Table.Column row)Every column, group columns included, each group before its children.
leafColumns
leafColumns : Table.Config row -> List (Table.Column row)Every leaf column, in definition order.
visibleLeafColumns
visibleLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)The leaf columns a table renders: State.columnOrder applied, hidden
columns dropped.
findColumn
findColumn : Table.Config row -> String -> Maybe (Table.Column row)Find a column by id. Group columns are found too.
columnFlatColumns
columnFlatColumns : Table.Column row -> List (Table.Column row)One column and every column below it, the column itself first.
columnLeafColumns
columnLeafColumns : Table.Column row -> List (Table.Column row)The leaf columns below one column. A leaf column returns itself.
Headers
headerGroups
headerGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)The header rows of a table, top row first.
flatHeaders
flatHeaders : Table.Config row -> Table.State -> List (Table.Header row)Every header of every header row.
leafHeaders
leafHeaders : Table.Config row -> Table.State -> List (Table.Header row)The leaf headers reachable from the top header row.
getLeafHeaders
getLeafHeaders : Table.Header row -> List (Table.Header row)The descendants of a header, deepest first, with the header itself last.
headerId
headerId : Table.Header row -> StringThe header id. Placeholder headers get a compound id.
headerColumnId
headerColumnId : Table.Header row -> StringThe id of the column this header renders.
headerColSpan
headerColSpan : Table.Header row -> IntHow many leaf columns this header spans.
headerRowSpan
headerRowSpan : Table.Header row -> IntHow many header rows this header spans. 0 means a header above already
covers this cell.
headerDepth
headerDepth : Table.Header row -> IntWhich header row this header belongs to, counted from 1 at the top.
headerIndex
headerIndex : Table.Header row -> IntThe header's position in its header row.
headerIsPlaceholder
headerIsPlaceholder : Table.Header row -> BoolIs this a filler header standing in for a column that has no group at this level?
headerPlaceholderId
headerPlaceholderId : Table.Header row -> Maybe StringHow many placeholders for the same column came before this one.
headerSubHeaders
headerSubHeaders : Table.Header row -> List (Table.Header row)The headers nested under this one.
Row models
The pipeline that turns your data into a row tree, the readers that walk one row, and the faceted values later stages sample from it.
Reading rows
rowId
rowId : Table.Row row -> StringThe row id.
rowIndex
rowIndex : Table.Row row -> IntThe row's index among its siblings.
rowDepth
rowDepth : Table.Row row -> IntHow deep the row sits in the row tree. Root rows are 0.
rowOriginal
rowOriginal : Table.Row row -> rowThe original datum this row was built from.
rowSubRows
rowSubRows : Table.Row row -> List (Table.Row row)The row's children.
rowParentId
rowParentId : Table.Row row -> Maybe StringThe id of the row's parent, when it has one.
rowOriginalSubRows
rowOriginalSubRows : Table.Row row -> List rowThe raw children Config.getSubRows returned for this row.
rowGroupingColumnId
rowGroupingColumnId : Table.Row row -> Maybe StringThe column a group row groups by, when the row is a group row.
rowGroupingValue
rowGroupingValue : Table.Row row -> Table.Value.ValueThe value a group row groups by.
rowLeafRows
rowLeafRows : Table.Row row -> List (Table.Row row)The leaf rows a group row was built from. Empty for ordinary rows.
rowAggregatedValues
rowAggregatedValues : Table.Row row -> Dict String Table.Value.ValueThe aggregated values of a group row, keyed by column id.
getValue
getValue : Table.Config row -> Table.Row row -> String -> Table.Value.ValueRead one cell value. Unknown columns and columns without an accessor give
Null.
getUniqueValues
getUniqueValues : Table.Config row -> Table.Row row -> String -> List Table.Value.ValueThe values faceting and grouping use for one cell. A column with
withGetUniqueValues decides them; otherwise the cell
value is wrapped in a one-item list.
getLeafRows
getLeafRows : Table.Row row -> List (Table.Row row)Every descendant of a row, depth first. The row itself is not included.
getParentRow
getParentRow : Table.RowModel row -> Table.Row row -> Maybe (Table.Row row)The direct parent of a row, looked up in a row model.
getParentRows
getParentRows : Table.RowModel row -> Table.Row row -> List (Table.Row row)The ancestors of a row, from the root down to its direct parent.
getAllCells
getAllCells : Table.Config row -> Table.State -> Table.Row row -> List Table.CellOne cell per leaf column, in leaf column order. Hidden columns are included.
findRow
findRow : Table.RowModel row -> String -> Maybe (Table.Row row)Look a row up by id.
maxSubRowDepth
maxSubRowDepth : Table.RowModel row -> IntThe deepest row depth in a row model, counting sub-rows and group rows.
A flat model is 0; one level of sub-rows makes it 1. Useful for sizing
indentation or the header checkbox of an expanding table.
The pipeline
rows
rows : Table.Config row -> Table.State -> Array row -> Table.RowModel rowThe whole pipeline: core, filtered, grouped, sorted, expanded, paginated, in that order.
A manual flag on the config skips its stage and passes the row model
through unchanged.
rowsFromList
rowsFromList : Table.Config row -> Table.State -> List row -> Table.RowModel rowThe List form of rows.
coreRowModel
coreRowModel : Table.Config row -> Table.State -> Array row -> Table.RowModel rowThe untouched row model: one row per datum, sub-rows resolved, ids assigned.
coreRowModelFromList
coreRowModelFromList : Table.Config row -> Table.State -> List row -> Table.RowModel rowThe List form of coreRowModel.
filteredRowModel
filteredRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel rowDrop the rows that fail the column filters and the global filter.
Config.manualFiltering skips this stage.
groupedRowModel
groupedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel rowReplace the rows with group rows. Config.manualGrouping skips this
stage.
sortedRowModel
sortedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel rowSort every level of the row tree. Config.manualSorting skips this
stage.
expandedRowModel
expandedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel rowFlatten the expanded branches into the row list.
Config.manualExpanding skips this stage.
paginatedRowModel
paginatedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel rowKeep only the rows of the current page. Config.manualPagination skips
this stage.
Faceting
facetedUniqueValues
facetedUniqueValues : Table.Config row -> Table.State -> Table.RowModel row -> String -> List ( Table.Value.Value, Int )Every distinct value of one column with the number of rows that carry it,
in first-seen order. Pass the pre-filtered row model (usually the core row
model); the count is taken over facetedRowModel, which
applies every filter except this column's own. List cells contribute each
item.
facetedMinMax
facetedMinMax : Table.Config row -> Table.State -> Table.RowModel row -> String -> Maybe ( Float, Float )The smallest and largest Number value of one column, or Nothing when
it has none. Pass the pre-filtered row model; like
facetedUniqueValues it looks through
facetedRowModel.
facetedRowModel
facetedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> String -> Table.RowModel rowThe rows a column's facets are computed from: the pre-filtered rows with every active filter applied except that column's own, so a filter UI keeps showing the values the user could switch to.
Pass the row model you handed to filteredRowModel.
Passing globalFacetKey as the column id excludes the
global filter instead of a column filter.
globalFacetKey
globalFacetKey : StringThe column id that stands for the global filter's own facet context,
"__global__". Passing it to facetedRowModel,
facetedUniqueValues or
facetedMinMax aggregates across every globally
filterable column.
Filtering
Column filters narrow a row model down to the rows that match; the global
filter runs the same comparison across every column that allows it. Every
reader that has to guess something from the data (an 'auto' filter
function, for instance) takes a RowModel row to sample, exactly like
TanStack, which samples the core or filtered row model for the same job.
Column filter state
getCanFilter
getCanFilter : Table.Config row -> String -> BoolCan this column carry a column filter? It needs an accessor, and neither
the column nor Config.enableColumnFilters nor Config.enableFilters may
have switched filtering off.
The filtered row model does not consult this: a State.columnFilters entry
for a column that answers False is still applied, matching TanStack.
getIsFiltered
getIsFiltered : Table.State -> String -> BoolDoes State.columnFilters hold an entry for this column?
getFilterValue
getFilterValue : Table.State -> String -> Maybe Table.Value.ValueThis column's current filter value, when it has one.
getFilterIndex
getFilterIndex : Table.State -> String -> IntThis column's position in State.columnFilters, or -1.
getFilterFn
getFilterFn : Table.Config row -> Table.RowModel row -> String -> Maybe Table.FilterFn.FilterFnThe filter function a column filters with: the one set with
withFilterFn, or the automatic choice. Nothing when the column does not
exist.
Pass the core row model; the automatic choice samples it.
getAutoFilterFn
getAutoFilterFn : Table.Config row -> Table.RowModel row -> String -> Table.FilterFn.FilterFnThe filter function 'auto' picks for a column, from the type of its
first non-null value: includesString for strings, inNumberRange for
numbers, equals for booleans, arrIncludes for lists, inDateRange for
dates, and weakEquals when every value is Null.
shouldAutoRemoveFilter
shouldAutoRemoveFilter : Maybe Table.FilterFn.FilterFn -> Table.Value.Value -> BoolShould a filter value be dropped from state instead of stored? A filter
function's own rule wins; without one, Null and the empty string are
dropped.
setColumnFilter
setColumnFilter : Table.Config row -> Table.RowModel row -> String -> Table.Value.Value -> Table.State -> Table.StateSet one column's filter value: replaced in place when the column already
has one, appended otherwise, and removed when
shouldAutoRemoveFilter says the value is blank.
Pass the core row model: a column without an explicit filter function picks its automatic one from the first values, and that choice decides the auto-remove rule.
setColumnFilters
setColumnFilters : Table.Config row -> Table.RowModel row -> List Table.ColumnFilter -> Table.State -> Table.StateReplace State.columnFilters wholesale, dropping the entries of known
columns whose value should auto-remove. Pass the core row model, as for
setColumnFilter.
resetColumnFilters
resetColumnFilters : Table.State -> Table.StateClear every column filter.
Global filter state
getCanGlobalFilter
getCanGlobalFilter : Table.Config row -> Table.RowModel row -> String -> BoolDoes the global filter run against this column? It needs an accessor,
Config.enableGlobalFilter and Config.enableFilters have to be on, the
column must not opt out, and Config.getColumnCanGlobalFilter (whose default
keeps a column only when its first non-null value is a string or a number)
has to agree.
getGlobalFilterFn
getGlobalFilterFn : Table.Config row -> Table.FilterFn.FilterFnThe filter function the global filter uses: Config.globalFilterFn, or
globalAutoFilterFn.
globalAutoFilterFn
globalAutoFilterFn : Table.FilterFn.FilterFnThe global filter's automatic function: Table.FilterFn.includesString.
setGlobalFilter
setGlobalFilter : Table.Value.Value -> Table.State -> Table.StateSet the global filter value.
resetGlobalFilter
resetGlobalFilter : Table.State -> Table.StateClear the global filter.
Sorting
One or more columns order the rows; withSortDescFirst, withInvertSorting,
and withSortUndefined tune how a single column compares.
Sort direction
SortDir
type alias SortDir =
Table.SortDirA sort direction.
sortAsc
sortAsc : Table.SortDirAscending.
sortDesc
sortDesc : Table.SortDirDescending.
Sorting state
getCanSort
getCanSort : Table.Config row -> String -> BoolCan this column be sorted? It needs an accessor and both the column and
Config.enableSorting have to allow it.
getCanMultiSort
getCanMultiSort : Table.Config row -> String -> BoolCan this column join a multi-sort? The column's own setting wins over
Config.enableMultiSort.
getIsSorted
getIsSorted : Table.State -> String -> Maybe Table.SortDirThis column's sort direction, or Nothing when it is not sorted.
getSortIndex
getSortIndex : Table.State -> String -> IntThis column's position in State.sorting, or -1.
getAutoSortFn
getAutoSortFn : Table.Config row -> Table.RowModel row -> String -> Table.SortFn.SortFnThe sort function 'auto' picks for a column. The first ten rows of the
row model are sampled: a date gives datetime, a string holding digits gives
alphanumeric, any other string gives text, and anything else gives
basic.
Pass the filtered row model, which is what TanStack samples.
getSortFn
getSortFn : Table.Config row -> Table.RowModel row -> String -> Table.SortFn.SortFnThe sort function a column sorts with: the one set with withSortFn, or
the automatic choice. A column set up with withCustomSort compares whole
rows and has no SortFn, so this reports its automatic choice while the row
model uses the custom comparison.
getAutoSortDir
getAutoSortDir : Table.Config row -> Table.RowModel row -> String -> Table.SortDirThe direction a column starts sorting in when nothing says otherwise: the first non-null value among the first ten rows decides, strings ascending and everything else descending.
getFirstSortDir
getFirstSortDir : Table.Config row -> Table.RowModel row -> String -> Table.SortDirThe direction the first click on a column sorts in: the column's
withSortDescFirst wins, then Config.sortDescFirst, then
getAutoSortDir.
getNextSortingOrder
getNextSortingOrder : Table.Config row -> Table.RowModel row -> Table.State -> String -> Bool -> Maybe Table.SortDirThe next step of a column's sort cycle. Nothing means the next step
removes the sort, which Config.enableSortingRemoval and (in a multi-sort)
Config.enableMultiRemove can forbid.
toggleSort
toggleSort : Table.Config row -> Table.RowModel row -> String -> { desc : Maybe Bool, multi : Bool } -> Table.State -> Table.StateStep a column's sort: add it, replace the sort with it, flip its direction, or remove it.
desc = Just d sets the direction outright instead of stepping the cycle.
multi = True asks to add to the existing sort rather than replace it, which
happens only when getCanMultiSort allows it;
Config.maxMultiSortColCount caps how many columns a multi-sort keeps.
The row model is the pre-sorted one (the grouped row model, or the core
row model when nothing is grouped or filtered): the first sort direction of
a column without sortDescFirst depends on its values.
setSorting
setSorting : List Table.SortColumn -> Table.State -> Table.StateReplace State.sorting.
clearSorting
clearSorting : String -> Table.State -> Table.StateRemove one column from State.sorting, leaving the others in order.
resetSorting
resetSorting : Table.State -> Table.StateClear every sort.
Pagination
Slices the pre-pagination row model into pages; Config.pageCount and
Config.rowCount stand in for a server-side count when the table is not
paginating in memory.
Pagination state
prePaginationRowModel
prePaginationRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel rowThe row model pagination slices, which is the expanded row model. The row counts and page counts below all read it.
rowsInDisplayOrder
rowsInDisplayOrder : Table.Config row -> Table.State -> Table.RowModel row -> List (Table.Row row)The rows a caller renders, in order. With
Config.paginateExpandedRows = False the expanded descendants that the
pre-pagination row model does not carry are inserted here.
displayIndex
displayIndex : Table.Config row -> Table.State -> Table.RowModel row -> Table.Row row -> IntA row's zero-based position in
rowsInDisplayOrder, or -1 when it is not there.
setPage
setPage : Table.Config row -> Int -> Table.State -> Table.StateGo to a page, clamped to [0, Config.pageCount - 1] when
Config.pageCount is set. A Config.pageCount of Just -1 means the count
is unknown and clamps nothing.
setPageSize
setPageSize : Int -> Table.State -> Table.StateChange the page size, at least 1. The page index moves so the row that
was at the top of the page stays in view.
setPagination
setPagination : Table.Pagination -> Table.State -> Table.StateReplace State.pagination.
resetPageIndex
resetPageIndex : Table.Config row -> Table.State -> Table.StateBack to page 0.
resetPageSize
resetPageSize : Table.State -> Table.StateBack to a page size of 10.
resetPagination
resetPagination : Table.State -> Table.StateBack to page 0 with a page size of 10.
getPageCount
getPageCount : Table.Config row -> Table.State -> Table.RowModel row -> IntHow many pages there are: Config.pageCount when it is set, otherwise
getRowCount divided by the page size, rounded up.
getPageOptions
getPageOptions : Table.Config row -> Table.State -> Table.RowModel row -> List IntEvery page index, [0, 1, ...].
getRowCount
getRowCount : Table.Config row -> Table.RowModel row -> IntHow many rows pagination is slicing: Config.rowCount when it is set,
otherwise the rows of the pre-pagination row model.
getCanPreviousPage
getCanPreviousPage : Table.State -> BoolIs there a page before this one?
getCanNextPage
getCanNextPage : Table.Config row -> Table.State -> Table.RowModel row -> BoolIs there a page after this one? An unknown page count always says yes.
getCanLastPage
getCanLastPage : Table.Config row -> Table.State -> Table.RowModel row -> BoolIs there a known last page after this one?
previousPage
previousPage : Table.Config row -> Table.State -> Table.StateGo back one page, clamped at 0.
nextPage
nextPage : Table.Config row -> Table.State -> Table.StateGo forward one page.
firstPage
firstPage : Table.Config row -> Table.State -> Table.StateGo to page 0.
lastPage
lastPage : Table.Config row -> Table.State -> Table.RowModel row -> Table.StateGo to the last page. A no-op when the page count is unknown or empty.
unlimitedPageSize
unlimitedPageSize : IntThe page size that puts every row on one page. Elm has no Infinity for
Int, so this is Number.MAX_SAFE_INTEGER where TanStack writes Infinity.
Grouping and aggregation
The grouped row model replaces the rows with one group row per distinct
value of every column in State.grouping, recursively, and rolls up every
other column with an AggregationFn.
Group rows carry rowGroupingColumnId,
rowGroupingValue, rowLeafRows, and
rowAggregatedValues, and their ids are
"columnId:groupingValue" joined to the parent group's id with >.
Grouping and expanding configuration
withRowCanExpand
withRowCanExpand : (Table.Row row -> Bool) -> Table.Config row -> Table.Config rowSet a per-row override for "can this row expand?", TanStack's
getRowCanExpand. It wins over Config.enableExpanding and over the
"has sub-rows" rule.
withIsRowExpanded
withIsRowExpanded : (Table.Row row -> Bool) -> Table.Config row -> Table.Config rowSet a per-row override for "is this row expanded?", TanStack's
getIsRowExpanded. It wins over State.expanded outright.
withMaxAggregationDepth
withMaxAggregationDepth : Int -> Table.Column row -> Table.Column rowHow far below an aggregated row its aggregation looks for values.
0, the default, aggregates the rows themselves; 1 aggregates their
children. TanStack's maxAggregationDepth.
Grouping state
getCanGroup
getCanGroup : Table.Config row -> String -> BoolCan this column be grouped? Grouping has to be enabled on the table and
on the column, and the column needs either an accessor or a
withGetGroupingValue.
getIsGrouped
getIsGrouped : Table.State -> String -> BoolIs this column in State.grouping?
getGroupedIndex
getGroupedIndex : Table.State -> String -> IntWhere this column sits in State.grouping, or -1.
toggleGrouping
toggleGrouping : String -> Table.State -> Table.StateAdd this column to State.grouping, or drop it and keep the rest in
order. TanStack's column_toggleGrouping does not check
getCanGroup either; its click handler does.
setGrouping
setGrouping : List String -> Table.State -> Table.StateReplace State.grouping.
resetGrouping
resetGrouping : Table.State -> Table.StateEmpty State.grouping.
rowIsGrouped
rowIsGrouped : Table.Row row -> BoolWas this row built by the grouped row model?
rowGroupingValueFor
rowGroupingValueFor : Table.Config row -> Table.Row row -> String -> Table.Value.ValueThe value this row groups by for one column:
withGetGroupingValue when the column has one, the
cell value otherwise.
cellIsGrouped
cellIsGrouped : Table.State -> Table.Row row -> String -> BoolIs this the cell of the column its group row groups by? Cell carries
its row and column ids, so this takes the row and the column id.
cellIsPlaceholder
cellIsPlaceholder : Table.State -> Table.Row row -> String -> BoolIs this the cell of a grouped column that is not this row's own grouping column? Those cells render as placeholders.
preGroupedRowModel
preGroupedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel rowThe row model grouping runs on: the filtered one.
Aggregation
getAutoAggregationFn
getAutoAggregationFn : Table.Config row -> Table.RowModel row -> String -> Maybe Table.AggregationFn.AggregationFnThe aggregation function a column with no
withAggregationFn gets: sum for a numeric column,
extent for a date column, none for anything else. The kind is read off the
first flat row of the row model handed in.
getAggregationFn
getAggregationFn : Table.Config row -> Table.RowModel row -> String -> Maybe Table.AggregationFn.AggregationFnThe aggregation function of a column: its own, or the automatic one.
aggregationValue
aggregationValue : Table.Config row -> Table.RowModel row -> String -> Table.Value.ValueAggregate one column over the rows of a row model, at the column's own
withMaxAggregationDepth. TanStack's
column.getAggregationValue().
aggregationValueOf
aggregationValueOf : Table.Config row -> Table.RowModel row -> String -> { maxDepth : Int, rows : List (Table.Row row) } -> Table.Value.ValueAggregate one column over a chosen row list and depth, TanStack's
column.getAggregationValue({ rows, maxDepth }). Use it for footers and
summaries that the grouped row model does not produce, for example the total
of a column over every filtered row. The row model is only there to resolve
an automatic aggregation function from the column's values; pass the core or
filtered model. maxDepth stops the descent into sub-rows; Nothing means
the column's own maxAggregationDepth.
cellIsAggregated
cellIsAggregated : Table.Config row -> Table.RowModel row -> Table.State -> Table.Row row -> String -> BoolIs this cell an aggregated one? True on a group row for a column that is neither the row's own grouping column nor itself grouped, and that has an aggregation function.
Expanding
Splices the sub-rows of expanded rows back into the row list, according to
State.expanded.
Expanded state
preExpandedRowModel
preExpandedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel rowThe row model expansion runs on: the sorted one.
getCanExpand
getCanExpand : Table.Config row -> Table.Row row -> BoolCan this row expand? withRowCanExpand wins,
otherwise Config.enableExpanding has to be on and the row needs sub-rows.
getIsExpanded
getIsExpanded : Table.Config row -> Table.State -> Table.Row row -> BoolIs this row expanded? withIsRowExpanded wins,
otherwise State.expanded decides.
getIsAllParentsExpanded
getIsAllParentsExpanded : Table.Config row -> Table.State -> Table.RowModel row -> Table.Row row -> BoolIs every ancestor of this row expanded? The row itself is not considered.
getCanSomeRowsExpand
getCanSomeRowsExpand : Table.Config row -> Table.RowModel row -> BoolCan any row of this row model expand? TanStack reads the pre-pagination row model here, so controls can reflect rows that are not on this page.
getIsSomeRowsExpanded
getIsSomeRowsExpanded : Table.State -> BoolIs any row expanded? True for expandAll and for a
non-empty expandedIds set; it does not check that the ids
still exist in the data, which is what TanStack's getIsSomeRowsExpanded
does too.
getIsAllRowsExpanded
getIsAllRowsExpanded : Table.Config row -> Table.State -> Table.RowModel row -> BoolIs every expandable row of this row model expanded? An empty
State.expanded is False, and so is one whose ids match no expandable row.
getExpandedDepth
getExpandedDepth : Table.Config row -> Table.State -> Table.RowModel row -> IntThe deepest expanded row id, counted in .-separated segments.
toggleExpanded
toggleExpanded : Table.Config row -> Table.RowModel row -> Table.Row row -> Maybe Bool -> Table.State -> Table.StateExpand or collapse one row. Nothing toggles it. Expanding a row that
cannot expand and any request that matches the current state are no-ops;
collapsing always applies, so a stale id can be cleaned up.
The row model materialises expandAll into the ids of the rows
that can expand before the change lands. Pass the pre-expanded row model
(the sorted row model, or whatever preExpandedRowModel
gives you), so group rows are included when grouping is on.
toggleAllRowsExpanded
toggleAllRowsExpanded : Table.Config row -> Table.RowModel row -> Maybe Bool -> Table.State -> Table.StateExpand or collapse every row. Nothing toggles on
getIsAllRowsExpanded.
setExpanded
setExpanded : Table.Expanded -> Table.State -> Table.StateReplace State.expanded.
resetExpanded
resetExpanded : Table.State -> Table.StateCollapse everything: State.expanded back to no ids.
Row selection
Row selection propagates to sub-rows and reports isSomeSelected and
isAllSelected per parent. Every transition is ... -> State -> State so it
pipes, and every query takes the Config and the State first, then the
row model or column it is about.
Selection types
SubRowSelection
type alias SubRowSelection =
Table.SubRowSelectionHow much of a parent row's sub-tree is selected.
SelectOptions
type alias SelectOptions =
Table.SelectOptionsThe options of a selection toggle. selectChildren also writes the
row's sub-tree; deselectParents drops the ancestors of a row that is being
deselected.
noSubRowsSelected
noSubRowsSelected : Table.SubRowSelectionNo selectable descendant of this row is selected.
someSubRowsSelected
someSubRowsSelected : Table.SubRowSelectionSome, but not all, selectable descendants are selected.
allSubRowsSelected
allSubRowsSelected : Table.SubRowSelectionEvery selectable descendant is selected.
defaultSelectOptions
defaultSelectOptions : Table.SelectOptionsselectChildren on, deselectParents off: TanStack's defaults.
These are abstract for the same reason as the types above, so they come with one function per variant.
Selection state
toggleRowSelected
toggleRowSelected : Table.Config row -> Table.RowModel row -> Table.Row row -> Maybe Bool -> Table.State -> Table.StateSelect or deselect one row; Nothing flips it. Sub-rows follow along.
The row model is only read for the parent chain, so the core row model is
the usual argument.
toggleRowSelectedWith
toggleRowSelectedWith : Table.Config row -> Table.SelectOptions -> Table.RowModel row -> Table.Row row -> Maybe Bool -> Table.State -> Table.StatetoggleRowSelected with explicit
SelectOptions.
toggleAllRowsSelected
toggleAllRowsSelected : Table.Config row -> Table.RowModel row -> Maybe Bool -> Table.State -> Table.StateSelect or deselect every row of the given model; Nothing flips on the
current all-selected state. Pass the filtered row model, which is what
TanStack's pre-grouped model is.
toggleAllPageRowsSelected
toggleAllPageRowsSelected : Table.Config row -> Table.RowModel row -> Maybe Bool -> Table.State -> Table.StateSelect or deselect every row of the current page. Pass the paginated row model.
deselectAllRows
deselectAllRows : Table.State -> Table.StateClear the selection, ids of rows that cannot be selected included. This
is TanStack's deselectAll option.
setRowSelection
setRowSelection : Set String -> Table.State -> Table.StateReplace the selection.
resetRowSelection
resetRowSelection : Table.State -> Table.StateClear the selection.
selectRange
selectRange : Table.Config row -> Table.RowModel row -> String -> Table.Row row -> Bool -> Table.State -> Table.StateSelect or deselect every row between an anchor id and this row, in
display order. Pass the pre-pagination row model (the expanded row model):
like TanStack's getRowsInDisplayOrder, the range ignores the current page
and honours Config.paginateExpandedRows, so a shift-click can span pages.
Falls back to an ordinary toggle when the range is not usable, which is what
the shift-click handler does.
selectRangeWith
selectRangeWith : Table.Config row -> Table.SelectOptions -> Table.RowModel row -> String -> Table.Row row -> Bool -> Table.State -> Table.StateselectRange with explicit
SelectOptions.
canSelectRange
canSelectRange : Table.Config row -> Table.State -> Table.RowModel row -> String -> Table.Row row -> BoolWould a range from this anchor to this row be selected as a range? Both endpoints have to be in the display order of the pre-pagination row model and allow multi-selection.
getIsRowSelected
getIsRowSelected : Table.State -> Table.Row row -> BoolIs this row selected?
getIsSomeRowsSelected
getIsSomeRowsSelected : Table.State -> BoolIs anything selected at all?
getIsAllRowsSelected
getIsAllRowsSelected : Table.Config row -> Table.State -> Table.RowModel row -> BoolIs every selectable row of the given model selected? Pass the filtered row model.
getIsAllPageRowsSelected
getIsAllPageRowsSelected : Table.Config row -> Table.State -> Table.RowModel row -> BoolIs every selectable row of the current page selected?
getIsSomePageRowsSelected
getIsSomePageRowsSelected : Table.Config row -> Table.State -> Table.RowModel row -> BoolIs any row of the current page selected, or partly selected?
getCanSelect
getCanSelect : Table.Config row -> Table.Row row -> BoolCan this row be selected?
getCanSelectSubRows
getCanSelectSubRows : Table.Config row -> Table.Row row -> BoolCan selecting this row select its sub-rows?
getCanMultiSelect
getCanMultiSelect : Table.Config row -> Table.Row row -> BoolCan this row take part in a multi-row selection?
getIsSomeSelected
getIsSomeSelected : Table.Config row -> Table.State -> Table.Row row -> BoolIs part, but not all, of this row's sub-tree selected?
getIsAllSubRowsSelected
getIsAllSubRowsSelected : Table.Config row -> Table.State -> Table.Row row -> BoolIs this row's whole sub-tree selected?
subRowSelection
subRowSelection : Table.Config row -> Table.State -> Table.Row row -> Table.SubRowSelectionHow much of this row's sub-tree is selected.
selectedRowIds
selectedRowIds : Table.State -> List StringThe selected row ids.
selectedRowModel
selectedRowModel : Table.State -> Table.RowModel row -> Table.RowModel rowKeep only the selected rows of a row model. Selected descendants of
unselected parents stay in flatRows and rowsById but not in rows,
exactly like TanStack's selectRowsFn. TanStack's three selected row models
are this function over the core, the filtered, and the sorted row model.
Pinning
Column pinning returns left, center, and right leaf column lists; row pinning does the same for rows. Neither one touches the DOM.
Pinning types
ColumnPinPosition
type alias ColumnPinPosition =
Table.ColumnPinPositionWhere a column is pinned: pinnedLeft,
pinnedRight, or columnUnpinned.
TanStack calls these 'start', 'end', and false.
ColumnRegion
type alias ColumnRegion =
Table.ColumnRegionWhich slice of the visible leaf columns a query is about.
allColumnsRegion is TanStack's absent position
argument and means the whole visible list in table order.
RowPinPosition
type alias RowPinPosition =
Table.RowPinPositionWhere a row is pinned: pinnedTop,
pinnedBottom, or rowUnpinned.
PinRowOptions
type alias PinRowOptions =
Table.PinRowOptionsThe options of pinRowWith: pin the row's leaf rows and
its ancestors along with it.
PinnedRowsSource
type alias PinnedRowsSource row =
Table.PinnedRowsSource rowThe two row models the pinned row lists read from. With
Config.keepPinnedRows on, a pinned row is taken from prePaginated even
when it is off the current page; with it off, only current is searched.
PinnedColumns
type alias PinnedColumns row =
Table.PinnedColumns rowThe three visible column slices of a pinned table.
pinnedLeft
pinnedLeft : Table.ColumnPinPositionPinned to the left edge. TanStack's 'start'.
pinnedRight
pinnedRight : Table.ColumnPinPositionPinned to the right edge. TanStack's 'end'.
columnUnpinned
columnUnpinned : Table.ColumnPinPositionNot pinned. Passing this to pinColumn unpins the column.
allColumnsRegion
allColumnsRegion : Table.ColumnRegionEvery visible leaf column, in table order, with no pin partitioning.
leftColumnsRegion
leftColumnsRegion : Table.ColumnRegionThe columns pinned to the left edge.
centerColumnsRegion
centerColumnsRegion : Table.ColumnRegionThe columns that are not pinned.
rightColumnsRegion
rightColumnsRegion : Table.ColumnRegionThe columns pinned to the right edge.
pinnedTop
pinnedTop : Table.RowPinPositionPinned to the top of the table.
pinnedBottom
pinnedBottom : Table.RowPinPositionPinned to the bottom of the table.
rowUnpinned
rowUnpinned : Table.RowPinPositionNot pinned. Passing this to pinRow unpins the row.
defaultPinRowOptions
defaultPinRowOptions : Table.PinRowOptionsPin the row alone, without its leaf rows or its ancestors.
These are abstract for the same reason as the types above, so they come with one function per variant.
Column pinning
pinColumn
pinColumn : Table.ColumnPinPosition -> Table.Column row -> Table.State -> Table.StatePin one column to an edge, or unpin it with
columnUnpinned. A group column pins every leaf below it.
setColumnPinning
setColumnPinning : Table.ColumnPinning -> Table.State -> Table.StateReplace the column pinning state.
resetColumnPinning
resetColumnPinning : Table.State -> Table.StateUnpin every column.
columnCanPin
columnCanPin : Table.Config row -> Table.Column row -> BoolCan this column be pinned? At least one leaf below it has to allow it and
Config.enableColumnPinning has to be on.
columnIsPinned
columnIsPinned : Table.State -> Table.Column row -> Table.ColumnPinPositionWhere is this column pinned? A group column reports the region of its first pinned leaf, left before right.
columnPinnedIndex
columnPinnedIndex : Table.State -> Table.Column row -> IntThe column's position inside its pinned region. Unpinned columns give
0, matching TanStack.
isSomeColumnsPinned
isSomeColumnsPinned : Table.State -> BoolIs any column pinned to either edge?
isSomeColumnsPinnedLeft
isSomeColumnsPinnedLeft : Table.State -> BoolIs any column pinned to the left edge?
isSomeColumnsPinnedRight
isSomeColumnsPinnedRight : Table.State -> BoolIs any column pinned to the right edge?
leftLeafColumns
leftLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)The leaf columns pinned left, in pinning-state order.
centerLeafColumns
centerLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)The leaf columns that are not pinned, in table order.
rightLeafColumns
rightLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)The leaf columns pinned right, in pinning-state order.
pinnedLeafColumns
pinnedLeafColumns : Table.Config row -> Table.State -> Table.ColumnRegion -> List (Table.Column row)The leaf columns of one region, hidden columns included.
leftVisibleLeafColumns
leftVisibleLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)The visible leaf columns pinned left.
centerVisibleLeafColumns
centerVisibleLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)The visible leaf columns that are not pinned.
rightVisibleLeafColumns
rightVisibleLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)The visible leaf columns pinned right.
pinnedVisibleLeafColumns
pinnedVisibleLeafColumns : Table.Config row -> Table.State -> Table.ColumnRegion -> List (Table.Column row)The visible leaf columns of one region.
allColumnsRegion gives
visibleLeafColumns unchanged.
pinnedColumns
pinnedColumns : Table.Config row -> Table.State -> Table.PinnedColumns rowThe three visible column slices at once, in render order.
leftHeaderGroups
leftHeaderGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)The header rows of the left-pinned columns.
centerHeaderGroups
centerHeaderGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)The header rows of the unpinned columns.
rightHeaderGroups
rightHeaderGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)The header rows of the right-pinned columns.
leftFlatHeaders
leftFlatHeaders : Table.Config row -> Table.State -> List (Table.Header row)Every header of the left-pinned header rows.
centerFlatHeaders
centerFlatHeaders : Table.Config row -> Table.State -> List (Table.Header row)Every header of the center header rows.
rightFlatHeaders
rightFlatHeaders : Table.Config row -> Table.State -> List (Table.Header row)Every header of the right-pinned header rows.
leftLeafHeaders
leftLeafHeaders : Table.Config row -> Table.State -> List (Table.Header row)The left-pinned headers that have no sub-headers.
centerLeafHeaders
centerLeafHeaders : Table.Config row -> Table.State -> List (Table.Header row)The center headers that have no sub-headers.
rightLeafHeaders
rightLeafHeaders : Table.Config row -> Table.State -> List (Table.Header row)The right-pinned headers that have no sub-headers.
leftVisibleCells
leftVisibleCells : Table.Config row -> Table.State -> Table.Row row -> List Table.CellThe visible cells of one row pinned left, in pinning-state order.
centerVisibleCells
centerVisibleCells : Table.Config row -> Table.State -> Table.Row row -> List Table.CellThe visible cells of one row whose column is not pinned.
rightVisibleCells
rightVisibleCells : Table.Config row -> Table.State -> Table.Row row -> List Table.CellThe visible cells of one row pinned right, in pinning-state order.
Row pinning
pinRow
pinRow : Table.RowPinPosition -> Table.Row row -> Table.State -> Table.StatePin one row to an edge, or unpin it with rowUnpinned.
Pinning removes the row id from the other edge first, so a row is never in
both lists. Whether pinned rows are drawn from the whole data set or only
the current page is Config.keepPinnedRows, read by topRows
and bottomRows. Use pinRowWith to pin a
row's parents or children along with it.
pinRowWith
pinRowWith : Table.RowPinPosition -> Table.PinRowOptions -> Table.RowModel row -> Table.Row row -> Table.State -> Table.StatepinRow with the leaf rows or the ancestors of the row pinned
along with it. The row model is where the ancestors are looked up.
setRowPinning
setRowPinning : Table.RowPinning -> Table.State -> Table.StateReplace the row pinning state.
resetRowPinning
resetRowPinning : Table.State -> Table.StateUnpin every row.
getIsRowPinned
getIsRowPinned : Table.State -> Table.Row row -> Table.RowPinPositionWhere is this row pinned?
getRowPinnedIndex
getRowPinnedIndex : Table.Config row -> Table.State -> Table.PinnedRowsSource row -> Table.Row row -> IntThe row's position among the pinned rows that are actually shown, or -1
when it is not pinned.
getCanPinRow
getCanPinRow : Table.Config row -> Table.Row row -> BoolCan this row be pinned?
isSomeRowsPinned
isSomeRowsPinned : Table.State -> BoolIs any row pinned at either edge?
isSomeRowsPinnedTop
isSomeRowsPinnedTop : Table.State -> BoolIs any row pinned to the top?
isSomeRowsPinnedBottom
isSomeRowsPinnedBottom : Table.State -> BoolIs any row pinned to the bottom?
topRows
topRows : Table.Config row -> Table.State -> Table.PinnedRowsSource row -> List (Table.Row row)The rows pinned to the top, in pinning-state order.
bottomRows
bottomRows : Table.Config row -> Table.State -> Table.PinnedRowsSource row -> List (Table.Row row)The rows pinned to the bottom, in pinning-state order.
centerRows
centerRows : Table.State -> Table.RowModel row -> List (Table.Row row)The rows of the current page that are not pinned.
Column ordering, visibility and sizing
Which columns render, in what order, and how wide each one is.
Column visibility
columnIsVisible
columnIsVisible : Table.State -> Table.Column row -> BoolIs this column visible? A group column is visible when any leaf below it is.
columnCanHide
columnCanHide : Table.Config row -> Table.Column row -> BoolCan this column be hidden? Both the column flag and Config.enableHiding
have to allow it.
toggleColumnVisibility
toggleColumnVisibility : Table.Config row -> Table.Column row -> Maybe Bool -> Table.State -> Table.StateShow or hide one column; Nothing flips it. A group column writes every
hideable leaf below it, because visibility is keyed by leaf column id.
setColumnVisibility
setColumnVisibility : Dict String Bool -> Table.State -> Table.StateReplace the whole visibility map.
resetColumnVisibility
resetColumnVisibility : Table.State -> Table.StateClear the visibility map, which shows every column again.
toggleAllColumnsVisible
toggleAllColumnsVisible : Table.Config row -> Maybe Bool -> Table.State -> Table.StateShow or hide every leaf column; Nothing flips the current state.
Columns that cannot hide stay visible.
isAllColumnsVisible
isAllColumnsVisible : Table.Config row -> Table.State -> BoolIs every leaf column visible?
isSomeColumnsVisible
isSomeColumnsVisible : Table.Config row -> Table.State -> BoolIs at least one leaf column visible?
visibleFlatColumns
visibleFlatColumns : Table.Config row -> Table.State -> List (Table.Column row)Every column of the table, group columns included, minus the hidden ones.
visibleCells
visibleCells : Table.Config row -> Table.State -> Table.Row row -> List Table.CellThe cells of one row whose column is visible: left-pinned first, then the unpinned cells in table order, then the right-pinned ones.
visibleCellsByColumnId
visibleCellsByColumnId : Table.Config row -> Table.State -> Table.Row row -> Dict String Table.CellThe visible cells of one row keyed by column id.
Column order
setColumnOrder
setColumnOrder : List String -> Table.State -> Table.StateReplace State.columnOrder.
resetColumnOrder
resetColumnOrder : Table.State -> Table.StateDrop State.columnOrder, restoring definition order.
orderColumns
orderColumns : Table.Config row -> Table.State -> List (Table.Column row) -> List (Table.Column row)Put a column list in table order: State.columnOrder first, unlisted
columns behind the listed ones, then the grouped-column rules.
orderGroupedColumns
orderGroupedColumns : Table.Config row -> Table.State -> List (Table.Column row) -> List (Table.Column row)Apply Config.groupedColumnMode to a leaf column list: move the grouped
columns to the front, remove them, or leave the list alone.
columnIndex
columnIndex : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> IntWhere this column sits in one region of the visible leaf columns, or -1
when it is not in that region.
columnIsFirst
columnIsFirst : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> BoolIs this the first visible column of the region?
columnIsLast
columnIsLast : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> BoolIs this the last visible column of the region?
Column sizing
getColumnSize
getColumnSize : Table.Config row -> Table.State -> Table.Column row -> FloatThe rendered width of a column: the committed size from
State.columnSizing when there is one, otherwise the column's own size and
then the configured default, clamped between minSize and maxSize.
getColumnStart
getColumnStart : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> FloatHow far from the start of its region a column begins.
getColumnAfter
getColumnAfter : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> FloatHow far from the end of its region a column ends.
setColumnSize
setColumnSize : String -> Float -> Table.State -> Table.StateCommit one column's size.
setColumnSizing
setColumnSizing : Dict String Float -> Table.State -> Table.StateReplace the whole sizing map.
resetColumnSize
resetColumnSize : String -> Table.State -> Table.StateDrop one column's committed size, leaving the other columns alone.
resetColumnSizing
resetColumnSizing : Table.State -> Table.StateDrop every committed size.
getHeaderSize
getHeaderSize : Table.Config row -> Table.State -> Table.Header row -> FloatThe width of a header: its column's size for a leaf header, the sum of the sub-header widths for a parent header.
getHeaderStart
getHeaderStart : Table.Config row -> Table.State -> List (Table.Header row) -> Table.Header row -> FloatHow far from the start of its header row a header begins. Pass the headers of the row the header belongs to.
totalSize
totalSize : Table.Config row -> Table.State -> FloatThe width of the whole table: the sum of the top header row.
leftTotalSize
leftTotalSize : Table.Config row -> Table.State -> FloatThe width of the left-pinned region.
centerTotalSize
centerTotalSize : Table.Config row -> Table.State -> FloatThe width of the unpinned region.
rightTotalSize
rightTotalSize : Table.Config row -> Table.State -> FloatThe width of the right-pinned region.
Cell spanning and cell selection
Spans merge adjacent cells; cell selection tracks rectangular ranges, focus, and keyboard movement over the visible grid. Optional; ignore this section if your table does not need either.
Span index types
CellSpanIndex
type alias CellSpanIndex =
Table.CellSpanIndexThe cell span index of the rows a caller renders. Build it with
cellSpanIndex and read it with
cellRowSpan, cellColSpan, and
cellIsCovered.
RowSpanContext
type alias RowSpanContext row =
Table.RowSpanContext rowWhat a withSpanRowsWhen predicate is given for each candidate row. The
run is anchored: anchorRow is the row whose cell renders the merged
content, and every later row of the run is tested against it.
Cell spanning
withCellSpanning
withCellSpanning : Bool -> Table.Config row -> Table.Config rowAllow or forbid cell spanning for the whole table. False makes every
cell report a span of 1 and builds no span index.
withEnableCellSpanning
withEnableCellSpanning : Bool -> Table.Column row -> Table.Column rowTurn one column off for cell spanning even when the table allows it.
withSpanRows
withSpanRows : Table.Column row -> Table.Column rowMerge adjacent rows whose value for this column is equal into one
vertically spanning cell. Null never merges under this comparison; use
withSpanRowsWhen to opt in.
withSpanRowsWhen
withSpanRowsWhen : (Table.RowSpanContext row -> Bool) -> Table.Column row -> Table.Column rowDecide per candidate row whether it joins the vertical run anchored at
anchorRow.
withSpanColumns
withSpanColumns : (Table.Row row -> Int) -> Table.Column row -> Table.Column rowMake this column's cell span that many columns in the given row, counted in render order. A span is clamped to the end of the cell's pinned region, so it never crosses the left, center, or right boundary.
spanAllColumns
spanAllColumns : IntThe stand-in for Infinity in a withSpanColumns
callback: "the rest of my region".
columnCanSpan
columnCanSpan : Table.Config row -> Table.Column row -> BoolDoes this column take part in cell spanning? A column opting out wins over the table option.
cellSpanIndex
cellSpanIndex : Table.Config row -> Table.State -> Table.RowModel row -> Table.CellSpanIndexBuild the span index of the rows a caller renders. Pass the row model you
render, which is normally paginatedRowModel; row
pinning is read off the state.
cellSpanIndexRowIds
cellSpanIndexRowIds : Table.CellSpanIndex -> List StringThe row ids the index was built from, in render order.
cellSpanIndexRowSpans
cellSpanIndexRowSpans : Table.CellSpanIndex -> Dict String (List Int)The vertical runs per column id, indexed by render-order row position. Only columns with at least one run longer than one row appear; a missing column means every cell in it spans exactly one row.
cellRowSpan
cellRowSpan : Table.CellSpanIndex -> Table.Cell -> IntHow many rows this cell spans: 1 when it does not span, and 0 when a
spanning cell above covers it. Never render a 0; skip the cell instead.
cellColSpan
cellColSpan : Table.CellSpanIndex -> Table.Cell -> IntHow many columns this cell spans: 1 when it does not span, and 0 when
another cell's column span covers it.
cellIsCovered
cellIsCovered : Table.CellSpanIndex -> Table.Cell -> BoolDoes another cell's span cover this cell? Covered cells carry no content of their own and must not be rendered.
Cell selection types
CellSelectionRange
type alias CellSelectionRange =
Table.CellSelectionRangeOne rectangular cell selection, stored as its two defining corners. The
anchor stays put while the focus corner moves during a shift-extend or a
drag, so the pair carries more than a normalized rectangle would. Build one
with cellRange.
CellSelectionOperation
type alias CellSelectionOperation =
Table.CellSelectionOperationHow a range changes the selection the ranges before it produced.
CellSelectionMode
type alias CellSelectionMode =
Table.CellSelectionModeWhether a write replaces the selection, adds a rectangle, or subtracts one.
CellSelectionBounds
type alias CellSelectionBounds =
Table.CellSelectionBoundsA range resolved into inclusive display-order indexes. Rows are positions
in rowsInDisplayOrder; columns are positions in the
visible leaf columns in render order.
CellSelectionEdges
type alias CellSelectionEdges =
Table.CellSelectionEdgesWhich sides of a selected cell sit on the outer boundary of the selection, for drawing a spreadsheet-style outline.
CellDirection
type alias CellDirection =
Table.CellDirectionOne step of keyboard navigation.
SelectionRows
type alias SelectionRows row =
Table.SelectionRows rowThe two row models cell selection reads: prePaginated fixes the
display-order indexes a range resolves against, so a range spans pages, and
current is the page a caller renders, which bounds keyboard navigation and
cell spanning. Without pagination both are the same model.
includeCells
includeCells : Table.CellSelectionOperationA range that adds its rectangle to the selection.
excludeCells
excludeCells : Table.CellSelectionOperationA range that subtracts its rectangle from the selection.
replaceSelection
replaceSelection : Table.CellSelectionModeReplace the whole selection with this rectangle.
includeSelection
includeSelection : Table.CellSelectionModeAdd this rectangle alongside the existing ranges.
excludeSelection
excludeSelection : Table.CellSelectionModeSubtract this rectangle from the existing ranges.
cellUp
cellUp : Table.CellDirectionMove or extend one row up.
cellDown
cellDown : Table.CellDirectionMove or extend one row down.
cellLeft
cellLeft : Table.CellDirectionMove or extend one column left.
cellRight
cellRight : Table.CellDirectionMove or extend one column right.
Cell selection options
withCellSelection
withCellSelection : Bool -> Table.Config row -> Table.Config rowAllow or forbid cell selection for the whole table.
withCellSelectionWhen
withCellSelectionWhen : (Table.Cell -> Bool) -> Table.Config row -> Table.Config rowDecide per cell whether it can be selected. The predicate replaces the
boolean, exactly like TanStack's enableCellSelection in its function form.
withCellRangeSelection
withCellRangeSelection : Bool -> Table.Config row -> Table.Config rowAllow or forbid extending a cell selection into a range, which is what shift-click and drag do.
withMultiCellRangeSelection
withMultiCellRangeSelection : Bool -> Table.Config row -> Table.Config rowAllow or forbid adding and subtracting further rectangles, which is what ctrl-click and meta-click do.
withEnableCellSelection
withEnableCellSelection : Bool -> Table.Column row -> Table.Column rowAllow or forbid selecting the cells of one column.
Cell selection transitions
cellRange
cellRange : String -> String -> String -> String -> Table.CellSelectionRangeA range from its two corners, taken as an inclusion:
cellRange anchorRowId anchorColumnId focusRowId focusColumnId.
setCellSelection
setCellSelection : List Table.CellSelectionRange -> Table.State -> Table.StateReplace the whole cellSelection slice.
clearCellSelection
clearCellSelection : Table.State -> Table.StateDrop every range. This is TanStack's resetCellSelection(table, true);
there is no separate resetCellSelection here because the feature default
is the empty list.
selectCellRange
selectCellRange : Table.CellSelectionRange -> Table.State -> Table.StateSelect a rectangle, replacing the selection.
selectCellRangeWith
selectCellRangeWith : Table.CellSelectionMode -> Table.CellSelectionRange -> Table.State -> Table.StateSelect a rectangle with replace, include, or exclude semantics.
selectAllCells
selectAllCells : Table.Config row -> Table.SelectionRows row -> Table.State -> Table.StateSelect every selectable cell as one range.
setFocusedCell
setFocusedCell : String -> String -> Table.State -> Table.StateCollapse the selection to a single cell at the given coordinates.
selectCell
selectCell : Table.Config row -> Table.Cell -> Table.State -> Table.StateStart a selection at one cell, replacing whatever was selected. This is
the state half of the mousedown handler with no modifier key.
extendCellSelectionTo
extendCellSelectionTo : Table.Config row -> Table.Cell -> Table.State -> Table.StateMove the active range's focus corner to this cell, keeping its anchor and
its operation. This is the state half of a shift-mousedown and of a drag's
mouseenter. With no active range, or with
withCellRangeSelection off, it selects the cell
instead.
toggleCellSelection
toggleCellSelection : Table.Config row -> Table.SelectionRows row -> Table.Cell -> Table.State -> Table.StateAdd a rectangle at this cell alongside the existing ranges, subtracting
instead when the cell is already selected. This is the state half of a ctrl-
or meta-mousedown. With
withMultiCellRangeSelection off, it selects
the cell instead.
moveCellSelection
moveCellSelection : Table.Config row -> Table.SelectionRows row -> Table.CellDirection -> Table.State -> Table.StateMove the selection one step, collapsing it to a single cell. Columns that cannot be selected are skipped over, and a merged cell is one stop. With nothing selected this selects the first selectable cell.
extendCellSelection
extendCellSelection : Table.Config row -> Table.SelectionRows row -> Table.CellDirection -> Table.State -> Table.StateExtend the active range one step, keeping its anchor fixed.
Cell selection queries
cellCanSelect
cellCanSelect : Table.Config row -> Table.Cell -> BoolCan this cell currently be selected? A column opting out wins over the table option.
cellIsSelected
cellIsSelected : Table.Config row -> Table.State -> Table.SelectionRows row -> Table.Cell -> BoolDoes this cell fall inside the final positive selection?
cellIsFocused
cellIsFocused : Table.State -> Table.Cell -> BoolIs this cell the active cell, the anchor of the most recent range? An exclusion's active cell is focused even though it is not selected.
cellTabIndex
cellTabIndex : Table.State -> Table.Cell -> Int0 for the focused cell and -1 otherwise, for a roving tabindex.
cellSelectionEdges
cellSelectionEdges : Table.Config row -> Table.State -> Table.SelectionRows row -> Table.Cell -> Table.CellSelectionEdgesWhich sides of this cell sit on the outer boundary of the selection. All
four are False when the cell is not selected.
focusedCell
focusedCell : Table.Config row -> Table.State -> Table.SelectionRows row -> Maybe Table.CellThe active cell: the anchor of the most recent range.
cellSelectionBounds
cellSelectionBounds : Table.Config row -> Table.State -> Table.SelectionRows row -> List Table.CellSelectionBoundsThe final positive selection as disjoint, inclusive display-order index rectangles, after every include and exclude is applied. A range whose corners no longer resolve is omitted rather than clamped, so it contributes nothing while staying in state.
cellSelectionMergeBounds
cellSelectionMergeBounds : Table.Config row -> Table.State -> Table.SelectionRows row -> List Table.CellSelectionBoundsThe merged-cell rectangles of the rendered rows, in the same index space. Selection rectangles grow to enclose these, so a merged cell is always entirely selected or entirely unselected.
cellSelectionColumnIndexes
cellSelectionColumnIndexes : Table.Config row -> Table.State -> Dict String IntThe render-order index of every visible column id.
selectedCellIds
selectedCellIds : Table.Config row -> Table.State -> Table.SelectionRows row -> List StringThe unique ids of all selected cells, in row-major order. Cells another cell's span covers are skipped, so the ids match what renders.
selectedCellCount
selectedCellCount : Table.Config row -> Table.State -> Table.SelectionRows row -> IntHow many cells are selected. A merged cell counts once.
selectedCellRangesData
selectedCellRangesData : Table.Config row -> Table.State -> Table.SelectionRows row -> List (List (List Table.Value.Value))Each final positive region's values as a row-major grid, indexed as region, then row, then column. Covered cells keep their values so the grid stays rectangular; serializing it is the caller's job.
cellSelectionRowIds
cellSelectionRowIds : Table.Config row -> Table.State -> Table.SelectionRows row -> List StringThe ids of all rows the selection intersects.
cellSelectionColumnIds
cellSelectionColumnIds : Table.Config row -> Table.State -> Table.SelectionRows row -> List StringThe ids of all columns the selection intersects.
Cell selection geometry
intersectCellSelectionBounds
intersectCellSelectionBounds : Table.CellSelectionBounds -> Table.CellSelectionBounds -> Maybe Table.CellSelectionBoundsThe overlap of two rectangles, or Nothing when they are disjoint.
subtractCellSelectionBounds
subtractCellSelectionBounds : Table.CellSelectionBounds -> Table.CellSelectionBounds -> List Table.CellSelectionBoundsThe parts of the first rectangle the second does not cover, as up to four disjoint rectangles.
addCellSelectionBounds
addCellSelectionBounds : List Table.CellSelectionBounds -> Table.CellSelectionBounds -> List Table.CellSelectionBoundsAdd a rectangle to a disjoint set, keeping the set disjoint.
mergeAdjacentCellSelectionBounds
mergeAdjacentCellSelectionBounds : List Table.CellSelectionBounds -> List Table.CellSelectionBoundsFuse rectangles that share a full side into one, to a fixed point.
expandCellSelectionBounds
expandCellSelectionBounds : Table.CellSelectionBounds -> List Table.CellSelectionBounds -> Table.CellSelectionBoundsGrow a rectangle until it fully contains every merged-cell rectangle it touches.
applyCellSelectionBoundsOperations
applyCellSelectionBoundsOperations : List ( Table.CellSelectionOperation, Table.CellSelectionBounds ) -> List Table.CellSelectionBoundsRun ordered include and exclude operations, giving the final positive selection as disjoint rectangles.