Closed Niraj-Kamdar closed 3 years ago
I also tried simpleform instead of tabbed one but I am still getting this error so I think that's not the root of the bug.
Hi @Niraj-Kamdar,
You are using RA.ReferenceManyField
instead of an input for editing modules.
Try to use a reference input instead.
I don't want to edit modules here. I just want to display it. Here's the example I referred to for this: https://marmelab.com/react-admin/CreateEdit.html#the-tabbedform-component
ReferenceInput
field wouldn't work due to one to many relationship. So, example seems the correct way to implement this.
I think problem is because of library passing modules
field which is a connection
to UpdateRoomInput
.
All right, when exactly do you get the error, is it when the room edit page is displaying (so you cannot see the page) or is it when you submit the form to edit the room?
Can you show me a screenshot of the error in the debug bar?
Thanks.
The way you are trying to display the modules is not going to work with the data provider.
You need to specify the name of the query in the target
attribute like so:
<RA.ReferenceManyField reference="modules" target="listModulesByRoomId.roomId" addLabel={false}>
<RA.Datagrid>
<RA.TextField source="id"/>
<RA.DateField source="createdAt"/>
<RA.DateField source="updatedAt"/>
<RA.EditButton/>
</RA.Datagrid>
</RA.ReferenceManyField>
Check the demo code for more info. It has a complex schema that covers many situations.
I will test it out.
I did as you told me to and changed value in target prop but I am still getting this error. Here's the video demo:
OK maybe you need to remove the modules field when submitting the form. Try with transform attribute, something like:
const editTransform = ({ modules, ...data }) => ({
...data,
});
export const RoomEdit = (props) => (
<Edit {...props} transform={editTransform}>
...
</Edit>
);
yeah, it solved the problem. Thanks.
I am getting this error while updating the form of modules resource.
Here's my schema
And here's my RoomEdit script:
I am not sure why am I getting this error. Am I doing anything wrong or Is it a bug in the library?