Skip to main content

Example: Nested filter groups

Advanced request (filters JSON):

[
{
"id": "email",
"variant": "text",
"operator": "iLike",
"value": "@company.com"
},
{
"type": "group",
"joinOperator": "and",
"filters": [
{"id": "country", "operator": "eq", "value": "AL", "variant": "select"},
{
"id": "email_verified",
"operator": "eq",
"value": "true",
"variant": "select",
"joinOperator": "or"
}
]
}
]

Handler stays the same — groups are handled inside ConditionsFromFilters:

q, _ := fiberv3query.Extract(c, columns)
where, args := datatable.ConditionsFromFilters(q.Filters, q.JoinOperator, columns)
// where ≈: (unaccent(lower(email)) LIKE ...) AND (country = ? OR email_verified = ?)

On the React side, enable advanced filters and build groups in DataTableFilterList.