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
These are a subset of the props accepted by `<List>` - only the props that change data fetching, and not the props related to the user interface.
66
+
These are a subset of the props accepted by `<List>` - only the props that change data fetching, and not the props related to the user interface.
67
+
68
+
In addition, `<ListBase>` renders its children components inside a `ListContext`. Check [the `<List children>` documentation](./List.md#children-list-layout) for usage examples.
Copy file name to clipboardExpand all lines: docs/ListTutorial.md
+29-5Lines changed: 29 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -545,14 +545,39 @@ Check [the Theming documentation](./Theming.md) for more information about the `
545
545
546
546
## Building a Custom Iterator
547
547
548
-
In some cases, neither the `<Datagrid>` nor the `<SimpleList>` components allow to display the records in an optimal way for a given task. In these cases, pass your layout component directly as children of the `<List>` component. As `<List>` takes care of fetching the data and putting it in a `ListContext`, you can leverage [the `useListContext` hook](./useListContext.md) to get the list data.
548
+
In some cases, neither the `<Datagrid>` nor the `<SimpleList>` components allow to display the records in an optimal way for a given task. In these cases, pass your layout component directly as children of the `<List>` component.
549
+
550
+
As `<List>` takes care of fetching the data and putting it in a `ListContext`, you can leverage [the `<WithListContext>` component](./WithListContext.md) to get the list data in a render prop.
Copy file name to clipboardExpand all lines: docs/ReferenceArrayField.md
+30-4Lines changed: 30 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,8 @@ You can change how the list of related records is rendered by passing a custom c
96
96
97
97
By default, `<ReferenceArrayField>` renders one string by related record, via a [`<SingleFieldList>`](./SingleFieldList.md) with a [`<ChipField>`](./ChipField.md) using the resource [`recordRepresentation`](./Resource.md#recordrepresentation).
98
98
99
+

100
+
99
101
You can pass any component of your own as child, to render the list of related records in another way.
100
102
101
103
That means that using the field without child:
@@ -121,16 +123,15 @@ Is equivalent to:
121
123
-[`<SimpleList>`](./SimpleList.md)
122
124
-[`<EditableDatagrid>`](./EditableDatagrid.md)
123
125
-[`<Calendar>`](./Calendar.md)
124
-
- Or a component of your own (check the [`usListContext`](./useListContext.md)chapter to learn how).
126
+
- Or a component of your own (check the [`<WithListContext>`](./WithListContext.md) and the [`useListContext`](./useListContext.md)chapters to learn how).
125
127
126
128
For instance, use a `<Datagrid>` to render the related records in a table:
`<ReferenceArrayField>` fetches all the related records, and displays them all, too. You can use the `filter` prop to filter the list of related records to display (this works by filtering the records client-side, after the fetch).
`<ReferenceManyField>` accepts a `reference` attribute, which specifies the resource to fetch for the related record. It also accepts a `source` attribute which defines the field containing the value to look for in the `target` field of the referenced resource. By default, this is the `id` of the resource (`authors.id` in the previous example).
75
75
76
-
You can also use `<ReferenceManyField>` in a list, e.g. to display the authors of the comments related to each post in a list by matching `post.id` to `comment.post_id`. We're using `<SingleFieldList>` to display an inline list using only one field for each of the referenced record:
76
+
You can also use `<ReferenceManyField>` in a list, e.g. to display the authors of the comments related to each post in a list by matching `post.id` to `comment.post_id`:
`<ReferenceManyField>` also accepts the [common field props](./Fields.md#common-field-props), except `emptyText` (use the child `empty` prop instead).
114
116
117
+
## `children`
118
+
119
+
`<ReferenceManyField>` renders its children inside a [`ListContext`](./useListContext.md). This means you can use any component that uses a `ListContext`:
120
+
121
+
-[`<SingleFieldList>`](./SingleFieldList.md)
122
+
-[`<Datagrid>`](./Datagrid.md)
123
+
-[`<SimpleList>`](./SimpleList.md)
124
+
-[`<EditableDatagrid>`](./EditableDatagrid.md)
125
+
-[`<Calendar>`](./Calendar.md)
126
+
- Or a component of your own (check the [`<WithListContext>`](./WithListContext.md) and the [`useListContext`](./useListContext.md) chapters to learn how).
127
+
128
+
For instance, use a `<Datagrid>` to render the related records in a table:
Copy file name to clipboardExpand all lines: docs/SingleFieldList.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ title: "The SingleFieldList Component"
7
7
8
8
Use `<SingleFieldList>` when you want to display only one property for each record in a list, for instance, to display the list of tag names for a post.
`<SingleFieldList>` is an **iterator** component: it gets `data` from the `ListContext`, and iterates over it to display each record. It creates a `<RecordContext>` for each record, and delegates the actual rendering to its child - usually a Field component.
0 commit comments