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:

  • resolveFilterValue normalises the filter value once per filter before any row is tested (the table does this, not filter).
  • resolveDataValue normalises the cell value before comparison (filter does this).
  • autoRemove says 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 under Table.rowColumnFiltersMeta. It is TanStack's addMeta callback turned into a return value.

Type

FilterFn

type FilterFn

A filter comparison with its resolvers.

Basic

equals

equals : Table.FilterFn.FilterFn

Strict equality.

weakEquals

weakEquals : Table.FilterFn.FilterFn

Loose equality ("1" == 1).

Strings

includesString

includesString : Table.FilterFn.FilterFn

Case-insensitive substring match.

includesStringSensitive

includesStringSensitive : Table.FilterFn.FilterFn

Case-sensitive substring match.

equalsString

equalsString : Table.FilterFn.FilterFn

Case-insensitive string equality.

equalsStringSensitive

equalsStringSensitive : Table.FilterFn.FilterFn

Case-sensitive string equality.

startsWith

startsWith : Table.FilterFn.FilterFn

Case-insensitive prefix match.

endsWith

endsWith : Table.FilterFn.FilterFn

Case-insensitive suffix match.

Blank

empty

empty : Table.FilterFn.FilterFn

Keeps blank cells. The filter value is only an on/off flag.

notEmpty

notEmpty : Table.FilterFn.FilterFn

Keeps non-blank cells. The filter value is only an on/off flag.

Numbers

greaterThan

greaterThan : Table.FilterFn.FilterFn

Numeric when both sides parse as numbers, string comparison otherwise.

greaterThanOrEqualTo

greaterThanOrEqualTo : Table.FilterFn.FilterFn

lessThan

lessThan : Table.FilterFn.FilterFn

lessThanOrEqualTo

lessThanOrEqualTo : Table.FilterFn.FilterFn

Ranges

between

between : Table.FilterFn.FilterFn

Exclusive range; the filter value is List [ min, max ].

betweenInclusive

betweenInclusive : Table.FilterFn.FilterFn

Inclusive range; the filter value is List [ min, max ].

inNumberRange

inNumberRange : Table.FilterFn.FilterFn

Inclusive numeric range; only Number cells can match.

inDateRange

inDateRange : Table.FilterFn.FilterFn

Inclusive date range on Date cells (or timestamps, or YYYY-MM-DD strings).

Arrays

arrHas

arrHas : Table.FilterFn.FilterFn

Scalar cell equals at least one of the filter values.

arrIncludes

arrIncludes : Table.FilterFn.FilterFn

List or String cell includes at least one filter value.

arrIncludesAll

arrIncludesAll : Table.FilterFn.FilterFn

List cell includes every filter value.

arrIncludesSome

arrIncludesSome : Table.FilterFn.FilterFn

List cell includes at least one filter value.

Building your own

custom

custom : (Table.Value.Value -> Table.Value.Value -> Bool) -> Table.FilterFn.FilterFn

Build 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.FilterFn

Replace the filter-value normaliser.

withResolveDataValue

withResolveDataValue : (Table.Value.Value -> Table.Value.Value) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFn

Replace the cell-value normaliser.

withAutoRemove

withAutoRemove : (Table.Value.Value -> Bool) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFn

Replace the auto-remove predicate.

withMeta

withMeta : (Table.Value.Value -> Table.Value.Value -> Maybe Table.Value.Value) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFn

Give 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 -> Bool

Test 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.Value

Normalise a filter value.

resolveDataValue

resolveDataValue : Table.FilterFn.FilterFn -> Table.Value.Value -> Table.Value.Value

Normalise a cell value.

autoRemove

autoRemove : Table.FilterFn.FilterFn -> Table.Value.Value -> Bool

Should 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 -> Float

toDateTimestamp 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.