[英]Using SimpleForm inside DataGrid and ReferenceManyField | react-admin
actually i try to use a SimpleForm inside a Datagrid and ReferenceManyField to show a joined table and also change this data.实际上,我尝试在 Datagrid 和 ReferenceManyField 中使用 SimpleForm 来显示连接表并更改此数据。 Showing the data and deleting works pretty fine but everytime i click on Save i get the following Error:显示数据和删除工作非常好,但每次我点击保存我都会收到以下错误:
` `
Uncaught TypeError: onSave.current is not a function
at submit (FormWithRedirect.js:86)
at Object.submit (final-form.es.js:1296)
at handleSubmit (react-final-form.es.js:264)
at FormWithRedirect.js:121
at handleClick (SaveButton.js:57)
` `
My actual Code:我的实际代码:
<Edit {...props}>
<SimpleShowLayout>
<DateField source="date" />
<ReferenceField label="Location" source="LocationID" reference="locations">
<TextField source="name" />
</ReferenceField>
<ReferenceField label="Employee" source="EmployeeID" reference="employees">
<TextField source="first_name" />
</ReferenceField>
<ReferenceManyField
label="Customers"
reference="bookings"
target="data"
>
<Datagrid>
<SimpleForm>
<TextInput label="Vorname" source="customer.first_name" />
<TextInput label="Nachname" source="customer.last_name" />
<BooleanInput label="Anwesend" source="present" />
</SimpleForm>
</Datagrid>
</ReferenceManyField>
</SimpleShowLayout>
</Edit>
According to docs SimpleForm
should be used with Create
and Edit
parent component as they pass save
and saving
to SimpleForm
.根据文档SimpleForm
应该与Create
和Edit
父组件一起使用,因为它们saving
save
和 save 传递给SimpleForm
。
You can also try write your custom onSave
function and manage saving
state.您也可以尝试编写自定义onSave
function 并管理saving
state。
<SimpleForm save={onSave} saving={saving}>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.