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

Embedded documents with reference #308

Closed
joshystuart opened this issue Feb 11, 2015 · 1 comment
Closed

Embedded documents with reference #308

joshystuart opened this issue Feb 11, 2015 · 1 comment
Labels

Comments

@joshystuart
Copy link

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!

@fzaninotto
Copy link
Member

Fixed by #714

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

No branches or pull requests

3 participants