Skip to main content
zerotal

Documentation


Documentation / @zerotal/admin / index / Filter

Class: Filter

Defined in: admin/src/table/Filter.ts:90

Constructors

Constructor

new Filter(key, type?): Filter

Defined in: admin/src/table/Filter.ts:102

Parameters

key

string

type?

FilterType = "select"

Returns

Filter

Methods

make()

static make(key): Filter

Defined in: admin/src/table/Filter.ts:107

Parameters

key

string

Returns

Filter


label()

label(label): this

Defined in: admin/src/table/Filter.ts:111

Parameters

label

string

Returns

this


column()

column(column): this

Defined in: admin/src/table/Filter.ts:117

Column to filter on (defaults to the filter key).

Parameters

column

string

Returns

this


options()

options(options): this

Defined in: admin/src/table/Filter.ts:123

Options for a select filter — {value: label} map or {value,label}[].

Parameters

options

Record<string, string> | FilterOption[]

Returns

this


labels()

labels(trueLabel, falseLabel): this

Defined in: admin/src/table/Filter.ts:131

Labels for the two states of a ternary filter.

Parameters

trueLabel

string

falseLabel

string

Returns

this


constraints()

constraints(constraints): this

Defined in: admin/src/table/Filter.ts:138

Comparisons a query-builder filter offers.

Parameters

constraints

Constraint[]

Returns

this


query()

query(fn): this

Defined in: admin/src/table/Filter.ts:144

Custom query scope; receives the raw active value.

Parameters

fn

FilterApply

Returns

this


getLabel()

getLabel(): string

Defined in: admin/src/table/Filter.ts:149

Returns

string


choices()

choices(): FilterOption[]

Defined in: admin/src/table/Filter.ts:154

The selectable options including the implicit "all"/ternary states.

Returns

FilterOption[]


apply()

apply(query, value): AdminQuery

Defined in: admin/src/table/Filter.ts:165

Apply this filter's scope for a chosen value.

Parameters

query

AdminQuery

value

string

Returns

AdminQuery