2017-08-18 80 views
0

我想在編輯頁面中顯示以下內容。我無法制作一個子數據網格來保存間隔部分。管理員休息:在編輯視圖中顯示Json網格

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

我猜我得子記錄某種方式傳遞到DataGrid中,但不知道該怎麼做?

回答