marmelab / ng-admin

Add an AngularJS admin GUI to any RESTful API
http://ng-admin-book.marmelab.com/
MIT License
3.95k stars 728 forks source link

How to render a 'reference_many' field just like a 'referenced_list' field #1316

Open garethsb-ghost opened 7 years ago

garethsb-ghost commented 7 years ago

The default rendering of reference_many is appropriate for things like tags and categories. In my use case, the user experience should be the same as for referenced_list, even though the relationship is held in the opposite (reference_many) direction. I'd like to see a list view even if only showing a single target field (although the option of multi column with several target fields just like referenced_list would be even better).

Probably this is possible now or an enhancement that could be added, but I haven't been able to work out how yet. Guidance gratefully received.

Phocea commented 7 years ago

You could try with a template or by using a custom type

Kmaschta commented 7 years ago

Hello,

As explained in the README, the GitHub issue tracker is for bugs and enhancement requests. So I close this issue, but feel free to write a question on StackOverflow with the tag ng-admin.

Thanks for using ng-admin!

garethsb-ghost commented 7 years ago

I considered this an enhancement request. Maybe I haven't investigated enough but as a new user who read through all the docs and examples and browsed the implementation, I couldn't see how this could be achieved.

Kmaschta commented 7 years ago

My bad! I open it again.

garethsb-ghost commented 7 years ago

Thank you, @Kmaschta. If there's a simple way to achieve this, I'd love to know and it'd make a good example in the docs. :-)

Kmaschta commented 7 years ago

If you want to write a PR, I suggest you to add an option to the ReferenceManyField to display something else than a ChoiceField (which is a ui-select).

Otherwise, the only way to change the reference_many is to write a custom type (as suggested by Phocea).