Skip to content

HowToReferencedFields

Carlo Barazzetta edited this page Jan 27, 2017 · 2 revisions

How to show fields from a referenced model

If you want to show in a Grid or in a Form a field from a referenced model, you have to customize the MainTable/Fields node of the view, by using the model.field notation and adding a local name to the field.

Example from [HelloKitto] (HelloKitto):

# model girl.yaml
ModelName: Girl
....
Fields:
......
  Phone: String(16)
    Rules:
      SubType: phone_number
# view dolls.yaml
Type: Data
Controller: List
.....
MainTable:
  Model: Doll
  Fields:
.....
    Mom:
    Mom.Phone: Mom_Phone
      DisplayLabel: _(Mom's Phone)

ReferencedFieldsGrid.png ReferencedFieldsForm.png

Clone this wiki locally