Skip to main content

GroupBy

Properties

NameTypeDescription
activeRuleGroupByRuleDefinition | undefinedIf no sort rule has been set, the first rule in the stack will be considered active.
requireGroupboolean
groupSortDirection'asc' | 'desc'
rulesGroupByRuleDefinition[]All rules, active or not. Useful for building controls.

Methods

set

finder.groupBy.set(id: GroupByRuleDefinition | string): void

toggle

If the groupBy rule is inactive, set it active. If already active, reset to the default.

finder.groupBy.toggle(id: GroupByRuleDefinition | string): void

setGroupSortDirection

finder.groupBy.setGroupSortDirection(direction: 'asc' | 'desc'): void

reset

Reset to initial values.

finder.groupBy.reset(): void

Example Usage

function GroupByControls() {
const finder = useFinder();
return (
<select onChange={(value) => finder.groupBy.set(value)}>
{finder.groupBy.rules.map((rule) => {
return (
<option value={rule.id} key={rule.id}>
{rule.label}
</option>
);
})}
</select>
);
}