kor TürkçeGitHub

FilterBar

Turns user input into UI5 filters for a list binding.

kor/ui/FilterBarSource

When to use

  • Let users narrow the same list by text, discrete values or numeric comparisons.

Examples

Add or remove a token

Loading the example

<k:FilterBar placeholder="Type a customer name" change=".onFilter">
	<k:FilterField label="Customer" path="customer"/>
</k:FilterBar>

Filter the order grid

Type “Aster” or “>5000”, then choose a suggestion. Remove the token to see all orders again.

Loading the example

<k:Stack gap="10">
	<k:FilterBar id="filter" placeholder="Search customers or amounts" change=".onFilter">
		<k:FilterField label="Customer" path="customer"/>
		<k:FilterField label="Amount" path="amount" type="number" unit="TRY"/>
	</k:FilterBar>
	<k:DataGrid id="grid" rows="{/orders}" height="13rem" label="Orders">
		<k:columns>
			<k:Column label="Order" path="id" width="100"/>
			<k:Column label="Customer" path="customer" grow="1"/>
			<k:Column label="Amount" path="amount" type="number"/>
		</k:columns>
	</k:DataGrid>
</k:Stack>

API

Properties

NameTypeDefaultDescription
placeholderstringSearch placeholder

Aggregations

NameTypeDescription
fieldsFilterField[]Fields available for filtering

Events

NameTypeDescription
stateChangeSerializable filter state changed
changefilters: objectFilters changed. Pass filters directly to ListBinding.filter

Methods

NameDescription
getFilters(): Filter[]Returns active filters, OR within a field and AND across fields
addToken(path: string, op: Token["op"], value: string | number): voidAdds a filter token programmatically
clear(): voidRemoves all tokens
getState(): objectReturns filter state for saving
setState(state: { path: string; op: Token["op"]; value: string | number }[]): voidRestores saved filter state

FilterField

A field available in a FilterBar.

Properties

NameTypeDefaultDescription
labelstringField label
pathstringModel path
typestringtexttext, number or option
optionsobjectAvailable choices
unitstringUnit displayed with a numeric value

Related

DataGridVariants