You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/misc.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ function convertQuery(query: RuleGroupTypeIC): RuleGroupType;
42
42
43
43
`convertQuery` toggles a query between the conventional `RuleGroupType` structure (with combinators at the group level) and the "independent combinators" structure (`RuleGroupTypeIC`, used with the [`independentCombinators` prop](./querybuilder#independentcombinators)).
44
44
45
-
`convertToIC` and `convertFromIC` do the same thing as `convertQuery`, but only in one direction.
45
+
`convertToIC` and `convertFromIC` do the same thing as `convertQuery`, but only in the directions indicated by their respective names.
To produce a query object with additional properties, you can loop through the `rules` array recursively. In the example below (from [issue #226](https://github.com/react-querybuilder/react-querybuilder/issues/226)), the `inputType` from the `fields` array is added to each rule.
38
+
To produce a query object with additional properties, you can loop through the `rules` array recursively. The [`transformQuery`](../api/misc#transformquery) function is provided for use cases such as this.
39
+
40
+
In the example below (inspired by [issue #226](https://github.com/react-querybuilder/react-querybuilder/issues/226)), the `inputType` from the `fields` array is added to each rule.
const result =transformQuery(query, { ruleProcessor });
57
+
```
58
+
59
+
<details>
60
+
<summary>Manual recursion</summary>
61
+
62
+
This example (_directly_ from [issue #226](https://github.com/react-querybuilder/react-querybuilder/issues/226)) demonstrates manual recursion to achieve exactly the same result as the `transformQuery` example above.
0 commit comments