marmelab / marmelab/ng-admin

In "creationView" I can't use two fields of type "reference" related to the same entity.

Open
#765 10 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
3.9k
Forks
703
PR merge metrics
No merged PRs in 30d

Description

In "creationView" I can't use two fields of type "reference" related to the same entity.
If I use two fields the data is duplicated in the select input, if I used three fields the data are tripled, and so on.

Entity Wallet:

```
"wallets": [{
"id": 1,
"currency": "ZZ",
"owner": 1,
"balance": "123123",
"country": "ASD",
"modification": "2015-10-13T15:20:43.366371Z",
"creation": "2015-10-13T15:20:43.366371Z"
}]

"charges": [{
...
"source_wallet": 5
"beneficiary_wallet": 8
...
}]
```

The Create View

```
charges.creationView()
.title('Create new Charge')
.fields([
...
nga.field('source_wallet', 'reference')
.label('Source Wallet')
.targetEntity(admin.getEntity('wallets'))
.targetField(nga.field('id'))
.singleApiCall(ids => ({ 'id': ids })),
nga.field('beneficiary_wallet', 'reference')
.label('Beneficiary Wallet')
.targetEntity(admin.getEntity('wallets'))
.targetField(nga.field('id'))
.singleApiCall(ids => ({ 'id': ids })),
...
]);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the charges.creationView() configuration and the two reference fields shown in the report, using the wallets and charges data to reproduce the duplicated select options. Trace how multiple reference fields targeting the same wallets entity load their choices; done means each field displays the wallets once rather than duplicating them.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.