Admin-On-Rest:在编辑视图中显示Json网格

时间:2017-08-18 15:27:28

标签: admin-on-rest

我想在编辑页面中显示以下内容。我在制作子数据网格以保持间隔部分时遇到问题。

[
{
    "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>

我猜我必须以某种方式将子记录传递到数据网格中,但不知道该怎么做?

1 个答案:

答案 0 :(得分:0)

目前无法做到这一点。但是,有人正在为此开展公关工作。见https://github.com/marmelab/admin-on-rest/pull/697