From bcd892a68b6a7a112329e6e0eba9ab44fe864fab Mon Sep 17 00:00:00 2001 From: erwanMarmelab Date: Tue, 23 Jul 2024 18:37:37 +0200 Subject: [PATCH 1/3] Mention `CreateInDialog` in `ReferenceManyField` doc --- docs/ReferenceManyField.md | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/ReferenceManyField.md b/docs/ReferenceManyField.md index 832edb923d..eedfd2f4e6 100644 --- a/docs/ReferenceManyField.md +++ b/docs/ReferenceManyField.md @@ -346,3 +346,45 @@ In these cases, use [the `` component](./ReferenceOneField.md ``` {% endraw %} + +## Adding a related record + +To allow users to create a record without leaving the current view, use the [``](./CreateInDialogButton.md) component. + +{% raw %} +```jsx +import { Edit, SimpleForm, TextInput, ReferenceManyField, WithRecord, Datagrid } from 'react-admin'; +import { CreateInDialogButton } from "@react-admin/ra-form-layout"; + +const EmployerEdit = () => ( + + + + + + + ( + + + + + + + )} + /> + + + + + + + +) +``` +{% endraw %} From 63221406db2e41752c4f554d0f455bc71b92ebc6 Mon Sep 17 00:00:00 2001 From: erwanMarmelab Date: Thu, 25 Jul 2024 12:21:11 +0200 Subject: [PATCH 2/3] Adding EditInDialogButton example --- docs/ReferenceManyField.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/ReferenceManyField.md b/docs/ReferenceManyField.md index eedfd2f4e6..1b2738a93c 100644 --- a/docs/ReferenceManyField.md +++ b/docs/ReferenceManyField.md @@ -347,14 +347,14 @@ In these cases, use [the `` component](./ReferenceOneField.md ``` {% endraw %} -## Adding a related record +## Adding or editing a related record -To allow users to create a record without leaving the current view, use the [``](./CreateInDialogButton.md) component. +To allow users to create or edit a record without leaving the current view, use the [``](./CreateInDialogButton.md) or the [``](./EditInDialogButton.md) component. {% raw %} ```jsx import { Edit, SimpleForm, TextInput, ReferenceManyField, WithRecord, Datagrid } from 'react-admin'; -import { CreateInDialogButton } from "@react-admin/ra-form-layout"; +import { CreateInDialogButton, EditInDialogButton } from "@react-admin/ra-form-layout"; const EmployerEdit = () => ( @@ -381,6 +381,14 @@ const EmployerEdit = () => ( + + + + + + From a182e4ed0e61ac19b61f2e14d23a0562e8076fbb Mon Sep 17 00:00:00 2001 From: erwanMarmelab Date: Fri, 26 Jul 2024 10:28:55 +0200 Subject: [PATCH 3/3] Adding a WithRecord --- docs/ReferenceManyField.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/ReferenceManyField.md b/docs/ReferenceManyField.md index 1b2738a93c..67e512ca31 100644 --- a/docs/ReferenceManyField.md +++ b/docs/ReferenceManyField.md @@ -381,14 +381,18 @@ const EmployerEdit = () => ( - - + ( + + - - + + + )} + />