【发布时间】:2020-05-04 10:02:23
【问题描述】:
我正在使用 react-admin 作为管理界面。在编辑表单之外,我想显示编辑后的值(只是为了了解如何捕获表单更改的值,稍后将显示来自 api 的这些更改值的数据)。我的代码如下(简体)
const Aside = ({ record }) => {
return (
<div style={{ width: 200, margin: '1em' }}>
<Typography variant="h6">Student details</Typography>
<Typography variant="body2">
{record && (
<Typography variant="body2">
{//Will Show current ArrayInput values here, Name/role of current students}
</Typography>
)}
</Typography>
</div>
)};
export const MyEdit = (props) => (
<Edit aside={<Aside />} {...props}>
<SimpleForm>
<ArrayInput source="students">
<SimpleFormIterator>
<TextInput source="name" /
<NumberInput source="role" />
</SimpleFormIterator>
</ArrayInput>
</SimpleForm>
</Edit>
);
如何更新 ArrayInput 值的 onchange?
【问题讨论】:
标签: reactjs react-admin admin-on-rest