-
Notifications
You must be signed in to change notification settings - Fork 708
Embedded documents with reference #308
Copy link
Copy link
Closed
Labels
Description
Hi there,
Firstly, thanks for the great software.
Secondly, this is a question more than an issue. I have the following data model:
Event
{
data: {
casualties: {
death: {
number: Number,
cause: String
},
injury: {
number: Number,
cause: String
}
},
punishment: {
number: Number,
penalty: String
}
}
}Causality
{
name: {type: String, index: true},
createdBy: {type: [String]},
updatedBy: {type: [String]}
}Punishment
{
name: {type: String, index: true},
createdBy: {type: [String]},
updatedBy: {type: [String]}
}I want to create a field in an edit view that has:
Death | field: number of deaths | reference to causality entity as a dropdown: cause
Injury | field: number of injuries | reference to causality entity as a dropdown: cause
Punishment | field: number of punishments | reference to penalties entity as a dropdown: penalty
I tried to create the following:
In config.js
...
.addField(new Reference('data')
.type('template')
.targetEntity(new Entity('casualties.casualties'))
.targetField(new Field('name'))
.template(function () {
return '<dataedit field="::field"></dataedit>';
}))
...However, when I tired to get the field.choices() in the data-edit directive, it returns an empty list, but it should contain entries.
I'm not sure if I'm going about this in the right way.
Any help would be greatly appreciated!
Reactions are currently unavailable