4

is there a way to remove submit button (toolbar) conditionally in specific Tabs, when using TabbedForm? (react-admin)

TabbedForm

Elen
  • 95
  • 7

2 Answers2

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
0

I'm afraid that's not possible unless you create your very own TabbedFormcomponent

Gildas Garcia
  • 6,966
  • 3
  • 15
  • 29