Skip to main content

group()

group<RG>(query: RG, sourcePathOrID: string | Path, targetPathOrID: string | Path, __namedParameters: GroupOptions): RG

Defined in: packages/react-querybuilder/src/utils/queryTools.ts:585

Creates a new group at a target path with its rules array containing the current objects at the target path and the source path. In the options parameter, pass { clone: true } to copy the source rule/group instead of move.

Type Parameters

Type Parameter
RG extends RuleGroupTypeAny

Parameters

ParameterTypeDescription
queryRGThe query to update.
sourcePathOrIDstring | PathPath of the rule/group to move or clone.
targetPathOrIDstring | PathPath of the target rule/group, which will become the path of the new group.
__namedParametersGroupOptionsOptions.

Returns

RG

The new query with the rules or groups grouped.


caution

API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.