Search code examples
admin-on-restapi-platform.comreact-admin

React-admin | How to concat source inside ReferenceField


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.sstatic.net/8z9LG.png

=>version https://i.sstatic.net/vCu9v.png

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

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

Best regards,


Solution

  • 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>