-->

React-admin | How to concat source inside Referenc

2019-08-02 09:14发布

问题:

I have a table "fos_user" and "version", I would like to display "9.0.1.A" instead of "/ version / 1".

=>fos_user https://i.imgur.com/C8f0qor.png

=>version https://i.imgur.com/HFSKIdz.png

Is it possible to concatenate the fields of the "version" table to display it in the source, like this? https://i.imgur.com/rxJBmtp.png

Because it will prevent me from creating a new field in the "version" table.

Best regards,

回答1:

React-admin | How to concat source inside ReferenceField ?

Answer:

<ReferenceField label="Version" source="version" reference="versions"> <FunctionField render={version => `${version.major}.${version.minor}.${version.patch}.${version.letter}`} /> </ReferenceField>