is there a way to remove submit button (toolbar) conditionally in specific Tabs, when using TabbedForm? (react-admin)
Asked
Active
Viewed 812 times
2 Answers
3
Here is how I did it using a custom toolbar:
<TabbedForm toolbar={<PostEditToolbar {...props} />}>...
The toolbar looks like this:
const PostEditToolbar = props => {
const { hasList, hasEdit, hasShow, hasCreate, redirect, ...rest } = props
return (
<Toolbar {...props}>
<Route exact path={'/Posts/:id/:tab_index'} render={props => ''} />
<Route
exact
path={'/Posts/:id'}
render={props => (
<SaveButton redirect={`/Posts/${rest.id}`} {...rest} />
)}
/>
</Toolbar>
)
}
You will need to import { Route } from 'react-router-dom'
for this and also adjust the route paths as needed.

borisdiakur
- 10,387
- 7
- 68
- 100
-
Thanks! Really helpful. – Elen Jul 12 '19 at 17:41
0
I'm afraid that's not possible unless you create your very own TabbedForm
component

Gildas Garcia
- 6,966
- 3
- 15
- 29
-
perhaps some hackish way? i've tried with some css magic but can't seem to find a good solution... – Elen May 04 '18 at 14:33
-