Custom layout in SimpleForm component on react-admin
I want to create a custom two-column-grid layout on my react-admin project on Edit and Show pages. I want to display selectboxes and the imageupload area on the left column, and the text inputs on the right column by using only one <SimpleForm>.
Simply like this
If I use a div or a <Card> component under <SimpleForm> and <EditController> components, I receive an error.
Warning: React does not recognize the `basePath` prop on a DOM element.
If you intentionally want it to appear in the DOM as a custom
attribute, spell it as lowercase `basepath` instead. If you
accidentally passed it from a parent component, remove it from the DOM
element.
Is there any way to create a layout without this error?
reactjs react-admin
add a comment |
I want to create a custom two-column-grid layout on my react-admin project on Edit and Show pages. I want to display selectboxes and the imageupload area on the left column, and the text inputs on the right column by using only one <SimpleForm>.
Simply like this
If I use a div or a <Card> component under <SimpleForm> and <EditController> components, I receive an error.
Warning: React does not recognize the `basePath` prop on a DOM element.
If you intentionally want it to appear in the DOM as a custom
attribute, spell it as lowercase `basepath` instead. If you
accidentally passed it from a parent component, remove it from the DOM
element.
Is there any way to create a layout without this error?
reactjs react-admin
It would be useful to see how you did in first place so we could see where the error came from.
– Green Magic
Dec 17 '18 at 12:04
add a comment |
I want to create a custom two-column-grid layout on my react-admin project on Edit and Show pages. I want to display selectboxes and the imageupload area on the left column, and the text inputs on the right column by using only one <SimpleForm>.
Simply like this
If I use a div or a <Card> component under <SimpleForm> and <EditController> components, I receive an error.
Warning: React does not recognize the `basePath` prop on a DOM element.
If you intentionally want it to appear in the DOM as a custom
attribute, spell it as lowercase `basepath` instead. If you
accidentally passed it from a parent component, remove it from the DOM
element.
Is there any way to create a layout without this error?
reactjs react-admin
I want to create a custom two-column-grid layout on my react-admin project on Edit and Show pages. I want to display selectboxes and the imageupload area on the left column, and the text inputs on the right column by using only one <SimpleForm>.
Simply like this
If I use a div or a <Card> component under <SimpleForm> and <EditController> components, I receive an error.
Warning: React does not recognize the `basePath` prop on a DOM element.
If you intentionally want it to appear in the DOM as a custom
attribute, spell it as lowercase `basepath` instead. If you
accidentally passed it from a parent component, remove it from the DOM
element.
Is there any way to create a layout without this error?
reactjs react-admin
reactjs react-admin
asked Nov 13 '18 at 10:10
rabbititusrabbititus
386
386
It would be useful to see how you did in first place so we could see where the error came from.
– Green Magic
Dec 17 '18 at 12:04
add a comment |
It would be useful to see how you did in first place so we could see where the error came from.
– Green Magic
Dec 17 '18 at 12:04
It would be useful to see how you did in first place so we could see where the error came from.
– Green Magic
Dec 17 '18 at 12:04
It would be useful to see how you did in first place so we could see where the error came from.
– Green Magic
Dec 17 '18 at 12:04
add a comment |
1 Answer
1
active
oldest
votes
I solved it with creating another component with using divs, <Grid/> etc, and used that component in <SimpleForm> component.
import withStyles from '@material-ui/core/styles';
import React from 'react';
import
EditController,
SimpleForm,
TextInput,
SelectInput,
Title,
from 'react-admin';
import Grid from '@material-ui/core/Grid';
import Card from '@material-ui/core/Card';
import Poster from "../customField/Poster";
import EditToolbar from '../toolbar/CustomToolbar'
import EditActions from '../toolbar/CustomActions'
const editStyles =
root: display: 'flex', alignItems: 'flex-start', width: '100%',
form: flexGrow: 9,
;
class CardEdit extends React.Component
constructor(props)
super(props);
this.state =
refresh: false
;
render()
const FormDiv = withStyles(editStyles)((children, classes, ...props) =>
return (
<div className=classes.root>
<div className=classes.form>
<Grid container spacing=24>
<Grid item xs=6>
<TextInput source="name" fullWidth />
</Grid>
<Grid item xs=6>
<TextInput source="card_id" fullWidth />
</Grid>
</Grid>
</div>
</div>
)
)
return (
<EditController ...this.props>
(resource, record, redirect, save, basePath, version) =>
return (
<div>
<Title defaultTitle="sample"/>
<Card>
<div style= margin: '20px 20px 0 0' >
<EditActions
basePath=basePath
resource=resource
data=record
hasShow
hasList
/>
</div>
record && (
<SimpleForm
basePath=basePath
redirect=redirect
resource=resource
record=record
save=save
version=version
toolbar=<EditToolbar/>
>
<FormDiv record=record />
</SimpleForm>
)
</Card>
</div>
)
</EditController>
)
export default withStyles(editStyles)(CardEdit);
Could you post code about how you did that? I am also interested in this.
– Green Magic
Dec 17 '18 at 12:03
@GreenMagic I edited my comment by adding my Edit page code for you to have a reference.
– rabbititus
Dec 20 '18 at 1:57
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278585%2fcustom-layout-in-simpleform-component-on-react-admin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I solved it with creating another component with using divs, <Grid/> etc, and used that component in <SimpleForm> component.
import withStyles from '@material-ui/core/styles';
import React from 'react';
import
EditController,
SimpleForm,
TextInput,
SelectInput,
Title,
from 'react-admin';
import Grid from '@material-ui/core/Grid';
import Card from '@material-ui/core/Card';
import Poster from "../customField/Poster";
import EditToolbar from '../toolbar/CustomToolbar'
import EditActions from '../toolbar/CustomActions'
const editStyles =
root: display: 'flex', alignItems: 'flex-start', width: '100%',
form: flexGrow: 9,
;
class CardEdit extends React.Component
constructor(props)
super(props);
this.state =
refresh: false
;
render()
const FormDiv = withStyles(editStyles)((children, classes, ...props) =>
return (
<div className=classes.root>
<div className=classes.form>
<Grid container spacing=24>
<Grid item xs=6>
<TextInput source="name" fullWidth />
</Grid>
<Grid item xs=6>
<TextInput source="card_id" fullWidth />
</Grid>
</Grid>
</div>
</div>
)
)
return (
<EditController ...this.props>
(resource, record, redirect, save, basePath, version) =>
return (
<div>
<Title defaultTitle="sample"/>
<Card>
<div style= margin: '20px 20px 0 0' >
<EditActions
basePath=basePath
resource=resource
data=record
hasShow
hasList
/>
</div>
record && (
<SimpleForm
basePath=basePath
redirect=redirect
resource=resource
record=record
save=save
version=version
toolbar=<EditToolbar/>
>
<FormDiv record=record />
</SimpleForm>
)
</Card>
</div>
)
</EditController>
)
export default withStyles(editStyles)(CardEdit);
Could you post code about how you did that? I am also interested in this.
– Green Magic
Dec 17 '18 at 12:03
@GreenMagic I edited my comment by adding my Edit page code for you to have a reference.
– rabbititus
Dec 20 '18 at 1:57
add a comment |
I solved it with creating another component with using divs, <Grid/> etc, and used that component in <SimpleForm> component.
import withStyles from '@material-ui/core/styles';
import React from 'react';
import
EditController,
SimpleForm,
TextInput,
SelectInput,
Title,
from 'react-admin';
import Grid from '@material-ui/core/Grid';
import Card from '@material-ui/core/Card';
import Poster from "../customField/Poster";
import EditToolbar from '../toolbar/CustomToolbar'
import EditActions from '../toolbar/CustomActions'
const editStyles =
root: display: 'flex', alignItems: 'flex-start', width: '100%',
form: flexGrow: 9,
;
class CardEdit extends React.Component
constructor(props)
super(props);
this.state =
refresh: false
;
render()
const FormDiv = withStyles(editStyles)((children, classes, ...props) =>
return (
<div className=classes.root>
<div className=classes.form>
<Grid container spacing=24>
<Grid item xs=6>
<TextInput source="name" fullWidth />
</Grid>
<Grid item xs=6>
<TextInput source="card_id" fullWidth />
</Grid>
</Grid>
</div>
</div>
)
)
return (
<EditController ...this.props>
(resource, record, redirect, save, basePath, version) =>
return (
<div>
<Title defaultTitle="sample"/>
<Card>
<div style= margin: '20px 20px 0 0' >
<EditActions
basePath=basePath
resource=resource
data=record
hasShow
hasList
/>
</div>
record && (
<SimpleForm
basePath=basePath
redirect=redirect
resource=resource
record=record
save=save
version=version
toolbar=<EditToolbar/>
>
<FormDiv record=record />
</SimpleForm>
)
</Card>
</div>
)
</EditController>
)
export default withStyles(editStyles)(CardEdit);
Could you post code about how you did that? I am also interested in this.
– Green Magic
Dec 17 '18 at 12:03
@GreenMagic I edited my comment by adding my Edit page code for you to have a reference.
– rabbititus
Dec 20 '18 at 1:57
add a comment |
I solved it with creating another component with using divs, <Grid/> etc, and used that component in <SimpleForm> component.
import withStyles from '@material-ui/core/styles';
import React from 'react';
import
EditController,
SimpleForm,
TextInput,
SelectInput,
Title,
from 'react-admin';
import Grid from '@material-ui/core/Grid';
import Card from '@material-ui/core/Card';
import Poster from "../customField/Poster";
import EditToolbar from '../toolbar/CustomToolbar'
import EditActions from '../toolbar/CustomActions'
const editStyles =
root: display: 'flex', alignItems: 'flex-start', width: '100%',
form: flexGrow: 9,
;
class CardEdit extends React.Component
constructor(props)
super(props);
this.state =
refresh: false
;
render()
const FormDiv = withStyles(editStyles)((children, classes, ...props) =>
return (
<div className=classes.root>
<div className=classes.form>
<Grid container spacing=24>
<Grid item xs=6>
<TextInput source="name" fullWidth />
</Grid>
<Grid item xs=6>
<TextInput source="card_id" fullWidth />
</Grid>
</Grid>
</div>
</div>
)
)
return (
<EditController ...this.props>
(resource, record, redirect, save, basePath, version) =>
return (
<div>
<Title defaultTitle="sample"/>
<Card>
<div style= margin: '20px 20px 0 0' >
<EditActions
basePath=basePath
resource=resource
data=record
hasShow
hasList
/>
</div>
record && (
<SimpleForm
basePath=basePath
redirect=redirect
resource=resource
record=record
save=save
version=version
toolbar=<EditToolbar/>
>
<FormDiv record=record />
</SimpleForm>
)
</Card>
</div>
)
</EditController>
)
export default withStyles(editStyles)(CardEdit);
I solved it with creating another component with using divs, <Grid/> etc, and used that component in <SimpleForm> component.
import withStyles from '@material-ui/core/styles';
import React from 'react';
import
EditController,
SimpleForm,
TextInput,
SelectInput,
Title,
from 'react-admin';
import Grid from '@material-ui/core/Grid';
import Card from '@material-ui/core/Card';
import Poster from "../customField/Poster";
import EditToolbar from '../toolbar/CustomToolbar'
import EditActions from '../toolbar/CustomActions'
const editStyles =
root: display: 'flex', alignItems: 'flex-start', width: '100%',
form: flexGrow: 9,
;
class CardEdit extends React.Component
constructor(props)
super(props);
this.state =
refresh: false
;
render()
const FormDiv = withStyles(editStyles)((children, classes, ...props) =>
return (
<div className=classes.root>
<div className=classes.form>
<Grid container spacing=24>
<Grid item xs=6>
<TextInput source="name" fullWidth />
</Grid>
<Grid item xs=6>
<TextInput source="card_id" fullWidth />
</Grid>
</Grid>
</div>
</div>
)
)
return (
<EditController ...this.props>
(resource, record, redirect, save, basePath, version) =>
return (
<div>
<Title defaultTitle="sample"/>
<Card>
<div style= margin: '20px 20px 0 0' >
<EditActions
basePath=basePath
resource=resource
data=record
hasShow
hasList
/>
</div>
record && (
<SimpleForm
basePath=basePath
redirect=redirect
resource=resource
record=record
save=save
version=version
toolbar=<EditToolbar/>
>
<FormDiv record=record />
</SimpleForm>
)
</Card>
</div>
)
</EditController>
)
export default withStyles(editStyles)(CardEdit);
edited Dec 20 '18 at 1:55
answered Nov 15 '18 at 3:11
rabbititusrabbititus
386
386
Could you post code about how you did that? I am also interested in this.
– Green Magic
Dec 17 '18 at 12:03
@GreenMagic I edited my comment by adding my Edit page code for you to have a reference.
– rabbititus
Dec 20 '18 at 1:57
add a comment |
Could you post code about how you did that? I am also interested in this.
– Green Magic
Dec 17 '18 at 12:03
@GreenMagic I edited my comment by adding my Edit page code for you to have a reference.
– rabbititus
Dec 20 '18 at 1:57
Could you post code about how you did that? I am also interested in this.
– Green Magic
Dec 17 '18 at 12:03
Could you post code about how you did that? I am also interested in this.
– Green Magic
Dec 17 '18 at 12:03
@GreenMagic I edited my comment by adding my Edit page code for you to have a reference.
– rabbititus
Dec 20 '18 at 1:57
@GreenMagic I edited my comment by adding my Edit page code for you to have a reference.
– rabbititus
Dec 20 '18 at 1:57
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278585%2fcustom-layout-in-simpleform-component-on-react-admin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It would be useful to see how you did in first place so we could see where the error came from.
– Green Magic
Dec 17 '18 at 12:04