Admin-On-Rest:在编辑视图中显示 Json 个网格
Admin-On-Rest: Display Json grid in edit view
我想在编辑页面中显示以下内容。我在制作子数据网格来保存间隔部分时遇到问题。
[
{
"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>
我想我必须以某种方式将子记录传递到数据网格中,但不确定该怎么做?
目前无法做到这一点。但是,有人正在为此进行 PR。参见 https://github.com/marmelab/admin-on-rest/pull/697
我想在编辑页面中显示以下内容。我在制作子数据网格来保存间隔部分时遇到问题。
[
{
"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>
我想我必须以某种方式将子记录传递到数据网格中,但不确定该怎么做?
目前无法做到这一点。但是,有人正在为此进行 PR。参见 https://github.com/marmelab/admin-on-rest/pull/697