React-admin: Allow linkType on Reference*Field

Created on 8 Jun 2017  路  4Comments  路  Source: marmelab/react-admin

It would be nice if I can specify a linkType on ReferenceManyField or ReferenceArrayField so that when using a SingleFieldList the containing Field would be wrapped with Link.

I could then do something like:

<ReferenceManyField label="Comments by" reference="comments" target="post_id" linkType="show">
  <SingleFieldList>
    <ChipField source="author.name" />
  </SingleFieldList>
</ReferenceManyField>

Which would make the Chip link to the respective comment.

enhancement good first issue

Most helpful comment

Any progress on this?

All 4 comments

@fzaninotto I would like to make a PR for this if it is something that is actually wanted?

A couple of implementation ideas:

a) Add linkType to ReferenceManyField and ReferenceArrayField with default false (to keep backward compatibility). Pass linkType to child. Implement rendering of Link in SingleFieldList.

b) Add linkType to SingleFieldList with default false (to keep backward compatibility). Implement rendering of Link in SingleFieldList.

c) Add a new component called SingleLinkFieldList (or similar). Add linkType to SingleLinkFieldList with default edit (same as ReferenceField). Implement rendering of Link in SingleLinkFieldList.

I think a) makes more sense considering the existing implementation of <ReferenceField>

Any progress on this?

Fixed by #1503

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yangjiamu picture yangjiamu  路  3Comments

Kmaschta picture Kmaschta  路  3Comments

9747749366 picture 9747749366  路  3Comments

mbj36 picture mbj36  路  3Comments

samanmohamadi picture samanmohamadi  路  3Comments