我想在编辑页面中显示以下内容。我在制作子数据网格以保持间隔部分时遇到问题。
[
{
"name": "Jenn",
"description": "",
"duration": 780,
"level": 2,
"instructor": 1,
"category": 1,
"equipment": [
1,
2
],
"intervals": [
{
"interval": 11,
"time": 30,
"Incline": 30
},
{
"interval": 34,
"time": 30,
"Incline": 0
}
],
"id": 1,
"createdAt": "2017-08-18T13:56:50.000Z",
"updatedAt": "2017-08-18T13:56:50.000Z"
}
这就是我目前所拥有的:
export const ClassEdit = (props) => (
<Edit title={<ClassTitle />} {...props}>
<SimpleForm>
<DisabledInput source="id" />
{/*<ReferenceInput label="instructor" source="instructor.id" reference="instructor">*/}
{/*<SelectInput optionText="name" />*/}
{/*</ReferenceInput>*/}
<TextInput source="name" />
<LongTextInput source="description" />
<NumberInput source="duration" />
<NumberInput source="level" />
<NumberInput source="instructor" />
<SelectInput source="category" choices={categoryList} />
<SelectArrayInput label="Equipment" source="equipment" choices={equipmentList}/>
<Datagrid >
<NumberField source="intervals.interval"/>
</Datagrid>
</SimpleForm>
</Edit>
我猜我必须以某种方式将子记录传递到数据网格中,但不知道该怎么做?