Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to display field from linked table in DetailViewer?

    I have two tables: "tasks" and "users". The field "executor" in table "task" points to a record in the table "users" (it uses field "id" as a key).
    Here is code from tasks.ds file:
    Code:
    <field name="executor" title="Executor" type="integer" foreignKey="user.id"  multiple="false" canEdit="true" canExport="true" hidden="false">
                <displayField>nickname</displayField>
                <filterEditorType>SelectItem</filterEditorType>
                <optionDataSource>user</optionDataSource>
                <valueField>id</valueField>
    </field>
    It works well when i use DynamicForm to edit this field: i can see SelectItem with values from "users" table.
    But when i tried to use DetailViewer to display record from the "tasks" table, the value for this field is empty:
    What is wrong in my *.ds file?

    #2
    Hi taurus,

    you'll need to add this:
    Code:
    <field name="nickname" includeFrom="user.nickname" />
    After that you'll see the necessary join being generated in the server log.
    Also I think that displayField should be attribute of your current field and not a sub-element. Same for filterEditorType.
    valueField is not allowed there (or perhaps: used by the framework) IMHO. Same for optionDataSource.

    Best regards
    Blama

    Comment


      #3
      Thank you, Blama! It works.

      Comment

      Working...
      X