I am looking for a way to allow Show to be able to use a Datagrid on the show page. I want to be able to click on the show button and when the show page appears, I want to be able to take data and make another grid using Datagrid or something similar. Any Ideas how this is done?
Asked
Active
Viewed 103 times
1 Answers
2
it seems show page take 1 record and render its. on show page you can place related records with current. for example news
can related with one project
and one project
has many news
. code below get from api all related news
and render its as a table. hope it helps you
export const ProjectShow = ({ ...props }) => (
<Show title={<ProjectTitle />} {...props}>
<SimpleShowLayout>
<ReferenceManyField label="News" reference="news" target="project_id">
<Datagrid>
<TextField source="id" />
<TextField source="title" />
<DateField source="created_at" showTime />
<DateField source="updated_at" showTime />
<EditButton />
</Datagrid>
</ReferenceManyField>
</SimpleShowLayout>
</Show>
);
don't remember place in App.js line:
<Resource name="projects" ...another actions... show={ProjectShow} />

Alexey
- 601
- 7
- 17
-
Thank you this seems to be exactly what I am looking for! – Stebermon May 25 '17 at 15:04