Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Add screencasts and screenshot to <EditableDatagrid> docs #9633

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion docs/EditableDatagrid.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,20 @@ const RowAction = () => (
);
```

<video controls autoplay playsinline muted loop>
<source src="./img/editableDatagrid-actions.webm" type="video/webm"/>
<source src="./img/editableDatagrid-actions.mp4" type="video/mp4"/>
Your browser does not support the video tag.
</video>

## `createForm`

The component displayed as the first row when a user clicks on the Create button. It's usually a form built with [`<RowForm>`](#rowform), with the same number of children as the `<EditableDatagrid>` has children.

```tsx
export const ArtistList = () => (
<List hasCreate empty={false}>
<EditableDatagrid
<EditableDatagrid
editForm={<ArtistForm />}
createForm={<ArtistForm />}
>
Expand Down Expand Up @@ -205,6 +211,12 @@ Use the `mutationMode` prop to specify the [mutation mode](./Edit.html#mutationm
</EditableDatagrid>
```

<video controls autoplay playsinline muted loop>
<source src="./img/editableDatagrid-mutationMode.webm" type="video/webm"/>
<source src="./img/editableDatagrid-mutationMode.mp4" type="video/mp4"/>
Your browser does not support the video tag.
</video>

## `noDelete`

You can disable the delete button by setting the `noDelete` prop to `true`:
Expand All @@ -214,6 +226,7 @@ You can disable the delete button by setting the `noDelete` prop to `true`:
{/*...*/}
</EditableDatagrid>
```
![EditableDatagrid noDelete](./img/editableDatagrid-noDelete.png)

## `<RowForm>`

Expand Down Expand Up @@ -319,6 +332,12 @@ Feel free to visit the [dedicated stories](https://react-admin.github.io/ra-ente

## Using Inside a `<ReferenceManyField>`

<video controls autoplay playsinline muted loop>
<source src="./img/editableDatagrid-referenceManyField.webm" type="video/webm"/>
<source src="./img/editableDatagrid-referenceManyField.mp4" type="video/mp4"/>
Your browser does not support the video tag.
</video>

You can use `<EditableDatagrid>` inside a `<ReferenceManyField>`. The only difference with its usage in a `<List>` is that you have to initialize the foreign key in the creation form using the `defaultValues` prop:

{% raw %}
Expand Down Expand Up @@ -384,6 +403,12 @@ In these examples, the same form component is used in `createForm` and `editForm

## Providing Custom Side Effects

<video controls autoplay playsinline muted loop>
<source src="./img/editableDatagrid-custom_side_effect.webm" type="video/webm"/>
<source src="./img/editableDatagrid-custom_side_effect.mp4" type="video/mp4"/>
Your browser does not support the video tag.
</video>

You can provide your own side effects in response to successful or failed save and delete actions, by passing functions to the `onSuccess` or `onError` inside the `mutationOptions` prop:

{% raw %}
Expand Down
Binary file added docs/img/editableDatagrid-actions.mp4
Binary file not shown.
Binary file added docs/img/editableDatagrid-custom_side_effect.mp4
Binary file not shown.
Binary file added docs/img/editableDatagrid-mutationMode.mp4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work on this one, kudos!

Binary file not shown.
Binary file added docs/img/editableDatagrid-noDelete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/editableDatagrid-referenceManyField.mp4
Binary file not shown.
Loading