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

editionView won't work with reference_many #1351

Open toblie opened 7 years ago

toblie commented 7 years ago

I created a model with some reference_many fields. Here a sample of it:

nga.field('topics', 'reference_many')
        .targetEntity(topic)
        .targetField(nga.field('name'))
        .label('Themen')

On creationView all is working fine but in editionView it only shows the items with "remove icon" but without labels.

bildschirmfoto 2017-06-29 um 14 07 34

And additional I got some errors on console... I dont know these requests and what they are for. Maybe the issue caused because of these errors.

bildschirmfoto 2017-06-29 um 14 05 15

It would be nice to get a solution or at least a little hint to solve this. Thanks

Kmaschta commented 7 years ago

Hello,

Can you provide a Plunkr in order to help us ?

Thanks

toblie commented 7 years ago

Thanks for your reply... but I think I can't because it is using my local REST API. so... you see the result above and my declaration of fields... maybe yo can identify any issue or missing declaration?

Thanks

toblie commented 7 years ago

Is there anyone who can help and maybe show me a sample of working reference_many editionView ? Thanks

danielesergio commented 7 years ago

I had the same problem, in my case the problem depended on type mismatch. The entity id was a numeric type but I tried to link this entity with a list of String instead of a list of number. This is a example: user: [ { id: '1', profil_pic:"http://www.free-icons-download.net/images/user-icon-44709.png", name: 'John', email: 'toto@admin', permissions: ["1","2","3"], // here the ids are string!!! } ]

permissions: { id: 1, //here the id is a number!!! name: 'ADMIN', gid: 1000 }

I don't know why it work on listView and showView but it doesn't work on editView.

Plunker link: https://next.plnkr.co/edit/POXOeJlnSxm9FRJq