【发布时间】:2020-05-01 09:41:11
【问题描述】:
实际上,我尝试在 Datagrid 和 ReferenceManyField 中使用 SimpleForm 来显示连接表并更改此数据。显示数据和删除工作非常好,但每次我点击保存我都会收到以下错误:
`
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)
`
我的实际代码:
<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>
【问题讨论】:
-
你的代码中的 onsave 函数在哪里?
标签: javascript reactjs react-admin