0

In ng-admin I am able to add a field of type reference and display the name of the referenced entity by

nga.field('schedule', 'reference')
  .targetEntity(schedule)
  .targetField(nga.field('name'))
  .label('Schedule'),

Is it possible to display a derived field of the referenced entity, say name (id)?

I tried using .template() with no luck.

Madhura Jayaratne
  • 2,204
  • 1
  • 15
  • 20

1 Answers1

2

You'll have to use map(), as seen in the Posters galore demo:

nga.field('schedule', 'reference')
  .targetEntity(schedule)
  .targetField(nga.field('name').map((v, e) => e.name + ' (' + e.id + ')'))
  .label('Schedule')
François Zaninotto
  • 7,068
  • 2
  • 35
  • 56