Reputation: 1227
I'm building an app with react-admin, I have an organizations resource and programs resource. each program has relation to one organization. (saved in mongoDB anf I have a node server)
I created a custom list to organizations resource.
<List {...props}>
<Datagrid rowClick={programsRowClick}>
<TextField source="name" />
<EditButton />
</Datagrid>
</List>
I want when we click on organization row to recieve all the programs that have the same organizationId.
the API is: https://localhost:4000/api/organization/${id}/programs
I tried to create a custom function programsRowClick but I dont realy understand what should it return?
the react run on https://localhost:3000 the server run on https://localhost:4000/api
could you help me?
thank's!
Upvotes: 1
Views: 3353
Reputation: 41
Maybe this can help you : https://marmelab.com/react-admin/List.html#expand
It allows you to display a custom component in the list on row click.
Otherwise rowClick
accept a function which returns a path.
ie :
<RA.Datagrid rowClick={(id: RA.Identifier) => `/${resource}/${id}/${customRoute}`}>
Upvotes: 4