In "creationView" I can't use two fields of type "reference" related to the same entity.
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 })),
...
]);
Anybody can help me about this? Is there something I'm doing wrong?
Thanks
I also have the same problem
+1
I also have the same problem. +1
+1 the same =(
+1 the same problem
+1
My workaround for that is to create different variables to use as reference in .targetEntity().
...
var usera = nga.entity('users');
var userb = nga.entity('users');
...
nga.field('usera_id', 'reference').targetEntity(usera),
nga.field('userb_id', 'reference').targetEntity(userb),
...
I even use .permanentFilters() to show different values for each field.
i use diff-entity to resove it,
detail:
[https://github.com/kane-chen/mview/blob/master/mview.adminui/src/main/webapp/admin/js/app1/definitions/widgets.js]
like:
defines:
-----------------------------------------------------------------------------------------------
var template_css = nga.entity('templates/type/css').identifier(nga.field('vkey'));
admin.addEntity(template_css);
var template_js = nga.entity('templates/type/js').identifier(nga.field('vkey'));
admin.addEntity(template_js);
......
use:
----------------------------------------------------------------------------------------------
nga.field('cssDefKey','reference').label('cssDefinition')
.targetEntity(admin.getEntity('templates/type/css'))
.targetField(nga.field('vkey'))
.validation({required:true})
.perPage(10),
nga.field('jsDefKey','reference').label('jsDefinition')
.targetEntity(admin.getEntity('templates/type/js'))
.targetField(nga.field('vkey'))
.perPage(10),
+1 Facing the same issue.
👍