I want to create a 'clone' button from react-admin
which will allow me to clone/copy the existing data record into another one and will open an sort of edit form to edit them and create a new entry. How can I do it?
P.S I am using Typescript
currently my code is like this
<Datagrid rowStyle={modelRowStyle}>
<TextField source="format" />
<TextField source="status" />
<EditButton basePath="/models" />
<DeleteButton basePath="/models" />
<CloneButton />
</Datagrid>
What should be the function of clone button should it be like edit (because it will take previous values) or like create(because I want to create new)
Create Component looks like this `
export const ModelCreate = (props: object) => (
<Create title="Create a Model" {...props}>
<SimpleForm toolbar={<ModelCreateToolbar />}>
<TextInput source="name" label="Name" autoWidth={true} />
<TextInput source="version" label="Version" />
<SelectInput source="format" label="Format" choices={Format} optionText="name" optionValue="format" />
<SelectInput source="group" label="Group" choices={Group} optionText="name" optionValue="group" />
</SimpleForm>
</Create>
);
`