How to disable delete action in List view in react admin?
Asked Answered
O

3

10

Before version 2 you could just not pass remove prop to <Resource/> component. However now delete action is included by default in <List/> view and I can't find anywhere in docs how I can disable it.

Oberammergau answered 29/11, 2018 at 11:15 Comment(0)
O
10

<Datagrid/> component has bulkActionButtons prop, where you can customize how bulk actions work. Here is the link to docs

If you are using the version 3 or lower you can provide the bulkActionButtons to the <List /> component.

https://github.com/marmelab/react-admin/blob/00ffc81e27d19b5242c93c28eb8b6668928439a0/docs/Upgrade.md#list-bulkactionbuttons-prop-moved-to-datagrid

Oberammergau answered 29/11, 2018 at 11:21 Comment(0)
P
16

Putting false to bulkActionButtons of List disables bulk actions.

<List bulkActionButtons={false}>
  ..
</List>

transGLUKator mentioned about bulkActionButtons but it took time for me to find value to disable bulk actions.

Reference

Source code of List of react-admin: https://github.com/marmelab/react-admin/blob/93bc43fcec652e6c2eaaa2dc7bdf45b2f64e12fb/packages/ra-ui-materialui/src/list/List.js#L128

Parmesan answered 11/7, 2019 at 8:59 Comment(0)
O
10

<Datagrid/> component has bulkActionButtons prop, where you can customize how bulk actions work. Here is the link to docs

If you are using the version 3 or lower you can provide the bulkActionButtons to the <List /> component.

https://github.com/marmelab/react-admin/blob/00ffc81e27d19b5242c93c28eb8b6668928439a0/docs/Upgrade.md#list-bulkactionbuttons-prop-moved-to-datagrid

Oberammergau answered 29/11, 2018 at 11:21 Comment(0)
N
2

The <List> bulkActionButtons prop is now deprecated—instead you use it directly on <DataGrid>, e.g.

<List>
  <Datagrid bulkActionButtons={false}>
    …
  </Datagrid>
</List>

See the DataGrid bulkActionButtons docs

Nickolenicks answered 18/9, 2022 at 18:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.