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/ReferenceArrayInput.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,7 @@ See the [`children`](#children) section for more details.
105
105
|`enableGet Choices`| Optional |`({q: string}) => boolean`|`() => true`| Function taking the `filterValues` and returning a boolean to enable the `getList` call. |
106
106
|`filter`| Optional |`Object`|`{}`| Permanent filters to use for getting the suggestion list |
107
107
|`label`| Optional |`string`| - | Useful only when `ReferenceArrayInput` is in a Filter array, the label is used as the Filter label. |
108
+
|`offline`| Optional |`ReactNode`| - | What to render when there is no network connectivity when loading the record |
108
109
|`page`| Optional |`number`| 1 | The current page number |
109
110
|`perPage`| Optional |`number`| 25 | Number of suggestions to show |
`<ReferenceArrayInput>` can display a custom message when the referenced record is missing because there is no network connectivity, thanks to the `offline` prop.
224
+
225
+
```jsx
226
+
<ReferenceArrayInput source="tags_ids" reference="tags" offline="No network, could not fetch data"/>
227
+
```
228
+
229
+
`<ReferenceArrayInput>` renders the `offline` element when:
230
+
231
+
- the referenced record is missing (no record in the `tags` table with the right `tags_ids`), and
232
+
- there is no network connectivity
233
+
234
+
You can pass either a React element or a string to the `offline` prop:
235
+
236
+
```jsx
237
+
<ReferenceArrayInput source="tags_ids" reference="tags" offline={<span>No network, could not fetch data</span>} />
238
+
<ReferenceArrayInput source="tags_ids" reference="tags" offline="No network, could not fetch data"/>
239
+
```
240
+
220
241
## `parse`
221
242
222
243
By default, children of `<ReferenceArrayInput>` transform the empty form value (an empty string) into `null` before passing it to the `dataProvider`.
0 commit comments