marmelab / marmelab/ng-admin

Using permanentFilters on two different fields which reference the same entity does not work

Open
#891 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
3.9k
Forks
703
PR merge metrics
No merged PRs in 30d

Description

projects.creationView()

.fields([
nga.field('name'),
nga.field('description'),
nga.field('accounting_rep','reference')
.targetEntity(admin.getEntity('employees'))
.targetField(nga.field('full_name'))
.permanentFilters({"department":"accounting"})
.label("Accounting Rep"),
nga.field('engineering_rep','reference')
.targetEntity(admin.getEntity('employees'))
.targetField(nga.field('full_name'))
.permanentFilters({"department":"engineering"})
.label("Engineering Rep")
]);

In this scenario, the dropdown lists for the accounting rep and engineering rep fields both show employees from both departments. I can see the browser make the request for the filtered lists and get back the correct responses from the server. So I think maybe ng-admin is using the same datastore for the referenced values in these two fields?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the projects.creationView() example with its two reference fields and their permanentFilters, then trace how the referenced employees values are loaded and stored. Verify the browser requests and compare the dropdown results for each field; done means accounting_rep shows only accounting employees while engineering_rep shows only engineering employees.

Written by the indexing model from the issue text.

Assessment

Tech stack
angularjs, javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.