-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Row expanded to edit fail - TypeError: f.pauseValidation is not a function #4436
Comments
The issue is:
Therefore, the example above is broken, because it's passing a string (intended to be the form ID) but this needs to be a FormApi instance. This also shows up in the documented example at https://marmelab.com/react-admin/List.html. Search for the comment "The form must have a name dependent on the record, because by default all forms have the same name". I don't know what the intended APIs are at all the layers, so I don't know where the form ID vs FormApi confusion has happened. I was able to work around this as below, but I don't know if this is going to work properly once I have multiple forms on the page.
|
Comparing https://marmelab.com/react-admin/CreateEdit.html#the-simpleform-component with https://marmelab.com/react-admin/doc/2.9/CreateEdit.html#the-simpleform-component, it looks like SimpleForm.form was removed / redefined. I guess that's the source of this confusion. |
I learn how to use it this way at https://marmelab.com/blog/2019/01/09/react-admin-2-6.html and I have deployed a working application in 2.6 to production. How can we do an equivalent staff in this version? |
I have managed to(at least partially) make it working by completely removing |
Do you have sample code snippets for your fix? |
Sure. This works import React from 'react'
import {List, Edit as RaEdit, Datagrid, TextField, SimpleForm, TextInput, NumberInput} from 'react-admin'
const Edit = props => (
<RaEdit {...props} title=" " undoable={false}>
<SimpleForm>
<TextInput source="comment" />
<NumberInput source="value" />
</SimpleForm>
</RaEdit>
)
const ItemList = props => (
<List {...props} bulkActionButtons={false}>
<Datagrid sort={{field: 'name'}} expand={<Edit />}>
<TextField source="value" />
<TextField source="comment" />
</Datagrid>
</List>
) |
@ewanmellor
|
I have resolved issue, Working in react-admin V 3.3.1 and following code.
|
What you were expecting:
Expanded and show the edit form
What happened instead:
exception throw TypeError: f.pauseValidation is not a function
Steps to reproduce:
Click expanded in the row of the data grid
Related code:
Environment
The text was updated successfully, but these errors were encountered: