Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: referenced_list field (ng-admin v0.8.0) #553

Closed
karantan opened this issue Jul 8, 2015 · 4 comments
Closed

bug: referenced_list field (ng-admin v0.8.0) #553

karantan opened this issue Jul 8, 2015 · 4 comments

Comments

@karantan
Copy link

karantan commented Jul 8, 2015

When I reported #552 issue I figure it that it only appears in 0.8.0 version. So now I'm using 0.7.0 version and with this I found another bug in 0.8.0. Before I moved to 0.7.0 I just taught that my code is the problem but when I switched to 0.7.0 this started to work.

So the bug is with listing one-many relations. Like Post and Comments. I have this code:

nga.field('article', 'referenced_list')
  .targetEntity(article)
  .targetReferenceField('user_id')
  .targetField(nga.field('id')),

In 0.7.0 this lists related articles to the user. It is just like in the example page... In 0.8.0 there is no error and you see only empty space

@karantan karantan changed the title bug: reference_list field (ng-admin v0.8.0) bug: referenced_list field (ng-admin v0.8.0) Jul 8, 2015
@karantan
Copy link
Author

karantan commented Jul 8, 2015

In 0.7.0 with referenced_list .targetReferenceField function isn't working. It always shows all the entities that you receive via the query. It does not filter them and assign only th

@karantan karantan closed this as completed Jul 8, 2015
@fzaninotto
Copy link
Member

On the demo, I can see related comments to a given post, using the master version (see http://ng-admin.marmelab.com/#/posts/show/1). It seems to work on my side, I can't reproduce your issue.

@denkhaus
Copy link

denkhaus commented Jul 8, 2015

I have the same issue. Its obvious since commit "5e16a3c30ec5ce6f913a1dd7d393d2397a30fbd3"
introduced with the new filter ui. Btw, the demo you mentioned, has the old filters style.

@karantan
Copy link
Author

karantan commented Jul 9, 2015

OK so if I understand this targetReferenceField only sets the 'name' to the e.g. post_id. If targetReferenceField is not called key of post_id will be null.

example:

...
.targetReferenceField('user')
...

will produce GET:

"http://127.0.0.1:1337/post?_filters=%7B%22user%22:%22559be50f90d212803ba5f2e5%22%7D&_page=1&_perPage=30&_sortField=null"

and if I do not set .targetReferenceField('user') ng-admin will do the next GET req:

"http://127.0.0.1:1337/post?_filters=%7B%22null%22:%22559be50f90d212803ba5f2e5%22%7D&_page=1&_perPage=30&_sortField=null"

The differece is with user and null in _filter param. Is this intended or is it a bug?

If this is intended then this means that the filtering should be done on the server side which is OK. I just think this should be stated somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants