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
Alternatively, you can pass a `render` function prop instead of children. The `render` prop will receive the `ListContext` as arguments, allowing to inline the render logic.
141
-
When receiving a `render` function prop the `<ReferenceManyFieldBase>` component will ignore the children property.
<i>{book.title}</i>, published on{''}{book.published_at}
166
-
</li>
167
-
))}
168
-
</ul>
169
-
);
170
-
}
171
-
}
172
-
/>
173
-
</ShowBase>
174
-
);
175
-
```
176
-
177
139
## `debounce`
178
140
179
141
By default, `<ReferenceManyFieldBase>` does not refresh the data as soon as the user enters data in the filter form. Instead, it waits for half a second of user inactivity (via `lodash.debounce`) before calling the `dataProvider` on filter change. This is to prevent repeated (and useless) calls to the API.
Use `empty` to customize the text displayed when the related record is empty.
156
+
Use `empty` to customize the text displayed when there are no related records.
195
157
196
158
```jsx
197
159
<ReferenceManyFieldBase
@@ -203,18 +165,6 @@ Use `empty` to customize the text displayed when the related record is empty.
203
165
</ReferenceManyFieldBase>
204
166
```
205
167
206
-
`empty` also accepts a translation key.
207
-
208
-
```jsx
209
-
<ReferenceManyFieldBase
210
-
reference="books"
211
-
target="author_id"
212
-
empty="resources.authors.fields.books.empty"
213
-
>
214
-
...
215
-
</ReferenceManyFieldBase>
216
-
```
217
-
218
168
`empty` also accepts a `ReactNode`.
219
169
220
170
```jsx
@@ -245,6 +195,32 @@ You can filter the query used to populate the possible values. Use the `filter`
245
195
246
196
{% endraw %}
247
197
198
+
## `offline`
199
+
200
+
Use `offline` to customize the text displayed when there are no related records because of lack of network connectivity.
201
+
202
+
```jsx
203
+
<ReferenceManyFieldBase
204
+
reference="books"
205
+
target="author_id"
206
+
offline="Offline, could not load data"
207
+
>
208
+
...
209
+
</ReferenceManyFieldBase>
210
+
```
211
+
212
+
`offline` also accepts a `ReactNode`.
213
+
214
+
```jsx
215
+
<ReferenceManyFieldBase
216
+
reference="books"
217
+
target="author_id"
218
+
empty={<p>Offline, could not load data</p>}
219
+
>
220
+
...
221
+
</ReferenceManyFieldBase>
222
+
```
223
+
248
224
## `perPage`
249
225
250
226
By default, react-admin restricts the possible values to 25 and displays no pagination control. You can change the limit by setting the `perPage` prop:
@@ -281,6 +257,45 @@ For instance, if you want to display the `books` of a given `author`, the `refer
281
257
</ReferenceManyFieldBase>
282
258
```
283
259
260
+
## `render`
261
+
262
+
Alternatively, you can pass a `render` function prop instead of children. The `render` prop will receive the `ListContext` as arguments, allowing to inline the render logic.
263
+
When receiving a `render` function prop the `<ReferenceManyFieldBase>` component will ignore the children property.
<i>{book.title}</i>, published on{''}{book.published_at}
288
+
</li>
289
+
))}
290
+
</ul>
291
+
);
292
+
}
293
+
}
294
+
/>
295
+
</ShowBase>
296
+
);
297
+
```
298
+
284
299
## `sort`
285
300
286
301
By default, it orders the possible values by id desc. You can change this order by setting the `sort` prop (an object with `field` and `order` properties).
0 commit comments