Unable to remove delete button from Edit component of react-admin
Asked Answered
S

1

7

I have successfully removed delete button from datagrid by suppling props bulkActionButtons={false} but Unable to remove delete button from Edit component of react-admin

export const UserEdit = (props) => (
  <Edit {...props}>
    <SimpleForm>
      <TextInput disabled source="id" />
      <TextInput source="email" />
    </SimpleForm>
  </Edit>
);
Superintend answered 29/4, 2020 at 16:52 Comment(1)
You must implement your Actions component and pass it to Edit: marmelab.com/react-admin/Show.html#actionsPorfirioporgy
H
15

You need to overwrite the toolbar component with a toolbar without DeleteButton

import * as React from "react";
import { Edit, SimpleForm, SaveButton, Toolbar } from 'react-admin';

const UserEditToolbar = props => (
    <Toolbar {...props} >
        <SaveButton />
    </Toolbar>
);

export const UserEdit = (props) => (
    <Edit {...props}>
        <SimpleForm toolbar={<UserEditToolbar />}>
            // ...
        </SimpleForm>
    </Edit>
);

Source: https://marmelab.com/react-admin/CreateEdit.html#the-simpleform-component

Hexangular answered 2/10, 2020 at 23:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.