我们想知道如何将现有/选定的记录从列表传递到 react admin 中的创建视图。
我们有一种情况,我们的列表视图中的每个条目都有一个编辑和创建按钮。我们希望能够为所述行单击“创建”,并能够在“创建”中显示该行/记录信息。我知道这听起来与编辑它没有什么不同,但我们希望能够从现有功能中复制/创建。如果我们只是使用普通的创建视图,我们需要从头开始填写信息。在某些情况下,我们希望在预先存在的数据之上创建。
我们问这个问题的另一个原因是 react-admin 文档明确指出:
接受记录道具,以基于值对象初始化表单。
我们假设您可以将您选择的记录传递给创建,我们已经尝试过,但它似乎不起作用。
任何帮助表示赞赏,谢谢。
这就是我的想法:
export const DataCreate = (props) => (
<Create title="Create new " {...props} >
<TabbedForm record={props.record}
//can we do something like this to pass record to create?>
<FormTab label = "Basic Info">
<TextInput source="type" label="type" />