2017-10-05 3 views
1

저는 admin-on-rest 프레임 워크를 사용하여 새 것으로, 중첩 된 양식을 작동시켜야합니다.admin-on-rest에서 중첩 양식이 작동하지 않습니다.

나는 두 가지 모델을 보여 주며 song.show()는 여러 곡을 가질 수 있습니다. 나는 그것이 예상대로 작동합니다 편집 양식을 보여줍니다.

쇼 편집 양식에 노래 양식을 추가해야하므로 각 쇼마다 여러 곡을 추가 할 수 있습니다.

나는 모든 방법을 시도했지만 끝내지 못했습니다.

이 내 코드입니다 :

<Edit title="Edit Show" {...this.props}> 
    <SimpleField> 
     <TextInput source="name" style={{ display: 'inline-block' }} /> 
     //here need to add song add form without reloading page 
     //this is songs grid 
      <ReferenceManyField reference="songs" target="show_id" label="Set List" perPage={5} > 
       <Datagrid> 
        <TextField source="song_name" /> 
        <EditButton /> 
        <DeleteButton /> 
       </Datagrid> 
      </ReferenceManyField> 
     //Here need to add song form, so i can add songs 
    </SimpleField> 
</Edit> 

내가 어떻게 이것을 달성 할 수 있습니까? 당신은 즉시 그들을 만들려면 당신이 쇼 또는를 작성하는 동안

<Edit title="Edit Show" {...this.props}> 
     <TextInput source="name" style={{ display: 'inline-block' }} /> 
     <ReferenceArrayInput label="Songs" source="songs_property_on_show" reference="songs" allowEmpty> 
      <SelectArrayInput optionText="song_name" translate={false}/> 
     </ReferenceArrayInput> 
</Edit> 

: 노래하면 그 질문에 대답하는 경우

+0

당신이 가지고있는 정확한 문제를 표시해야합니다. 우리를 추측하지 마십시오. – jdv

+1

품질 향상을 위해 변경된 질문 – Kalamarico

답변