Table.FilterFn
Generated from docs.json. 34 exposed values, types, and type aliases, in the order the module exposes them.
Built-in filter functions, ported from column-filtering/filterFns.ts.
A FilterFn is a comparison between a cell value and a filter value plus
three helpers that TanStack attaches to every filter fn:
resolveFilterValuenormalises the filter value once per filter before any row is tested (the table does this, notfilter).resolveDataValuenormalises the cell value before comparison (filterdoes this).autoRemovesays when a filter value is blank enough that the filter should be dropped from state.meta, when the filter fn has one, produces the value the filtered row model records for the row underTable.rowColumnFiltersMeta. It is TanStack'saddMetacallback turned into a return value.
Type
FilterFn
type FilterFnA filter comparison with its resolvers.
Basic
equals
equals : Table.FilterFn.FilterFnStrict equality.
weakEquals
weakEquals : Table.FilterFn.FilterFnLoose equality ("1" == 1).
Strings
includesString
includesString : Table.FilterFn.FilterFnCase-insensitive substring match.
includesStringSensitive
includesStringSensitive : Table.FilterFn.FilterFnCase-sensitive substring match.
equalsString
equalsString : Table.FilterFn.FilterFnCase-insensitive string equality.
equalsStringSensitive
equalsStringSensitive : Table.FilterFn.FilterFnCase-sensitive string equality.
startsWith
startsWith : Table.FilterFn.FilterFnCase-insensitive prefix match.
endsWith
endsWith : Table.FilterFn.FilterFnCase-insensitive suffix match.
Blank
empty
empty : Table.FilterFn.FilterFnKeeps blank cells. The filter value is only an on/off flag.
notEmpty
notEmpty : Table.FilterFn.FilterFnKeeps non-blank cells. The filter value is only an on/off flag.
Numbers
greaterThan
greaterThan : Table.FilterFn.FilterFnNumeric when both sides parse as numbers, string comparison otherwise.
greaterThanOrEqualTo
greaterThanOrEqualTo : Table.FilterFn.FilterFnSee greaterThan.
lessThan
lessThan : Table.FilterFn.FilterFnSee greaterThan.
lessThanOrEqualTo
lessThanOrEqualTo : Table.FilterFn.FilterFnSee greaterThan.
Ranges
between
between : Table.FilterFn.FilterFnExclusive range; the filter value is List [ min, max ].
betweenInclusive
betweenInclusive : Table.FilterFn.FilterFnInclusive range; the filter value is List [ min, max ].
inNumberRange
inNumberRange : Table.FilterFn.FilterFnInclusive numeric range; only Number cells can match.
inDateRange
inDateRange : Table.FilterFn.FilterFnInclusive date range on Date cells (or timestamps, or YYYY-MM-DD
strings).
Arrays
arrHas
arrHas : Table.FilterFn.FilterFnScalar cell equals at least one of the filter values.
arrIncludes
arrIncludes : Table.FilterFn.FilterFnList or String cell includes at least one filter value.
arrIncludesAll
arrIncludesAll : Table.FilterFn.FilterFnList cell includes every filter value.
arrIncludesSome
arrIncludesSome : Table.FilterFn.FilterFnList cell includes at least one filter value.
Building your own
custom
custom : (Table.Value.Value -> Table.Value.Value -> Bool) -> Table.FilterFn.FilterFnBuild a filter fn from a comparison. Resolvers default to identity
and autoRemove defaults to removing Null and the empty string.
withResolveFilterValue
withResolveFilterValue : (Table.Value.Value -> Table.Value.Value) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFnReplace the filter-value normaliser.
withResolveDataValue
withResolveDataValue : (Table.Value.Value -> Table.Value.Value) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFnReplace the cell-value normaliser.
withAutoRemove
withAutoRemove : (Table.Value.Value -> Bool) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFnReplace the auto-remove predicate.
withMeta
withMeta : (Table.Value.Value -> Table.Value.Value -> Maybe Table.Value.Value) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFnGive a filter fn the meta the filtered row model records for every row it
tests, TanStack's addMeta callback.
The function is handed the already resolved cell value and the already
resolved filter value, the same two values filter compares, and
Nothing records nothing for that row. This is how the fuzzy-filter example
stores its match rank and then sorts by it.
Applying
filter
filter : Table.FilterFn.FilterFn -> Table.Value.Value -> Table.Value.Value -> BoolTest a raw cell value against an already resolved filter value. The
cell value is passed through resolveDataValue first; the filter value is
not (resolve it once with resolveFilterValue).
resolveFilterValue
resolveFilterValue : Table.FilterFn.FilterFn -> Table.Value.Value -> Table.Value.ValueNormalise a filter value.
resolveDataValue
resolveDataValue : Table.FilterFn.FilterFn -> Table.Value.Value -> Table.Value.ValueNormalise a cell value.
autoRemove
autoRemove : Table.FilterFn.FilterFn -> Table.Value.Value -> BoolShould this filter value cause the filter to be dropped?
meta
meta : Table.FilterFn.FilterFn -> Maybe (Table.Value.Value -> Table.Value.Value -> Maybe Table.Value.Value)The filter fn's meta producer, when withMeta gave it one.
Nothing is the common case and lets the filtered row model skip the work
entirely.
Dates
toDateTimestamp
toDateTimestamp : Table.Value.Value -> FloattoDateTimestamp from filterFns.ts: a Date gives its milliseconds,
a Number passes through, and everything else that is not a parseable date
string gives NaN, which never falls inside a range.
Elm has no new Date(string), so the string form is limited to ISO 8601
YYYY-MM-DD, optionally followed by THH:MM, THH:MM:SS and a Z.