Announcement

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

    DynamicForm Nesting

    The solution: DynamicForm.showComplexFieldsRecursively

    -----

    Is it possible to nest DynamicForm multiple times?

    For example: Application -> Applicant -> Address

    application.ds.xml
    Code:
    <DataSource ID="application">
      <fields>
        <field name="memo" type="text" />
        <field name="applicant" type="applicant" />
      </fields>
    </DataSource>
    applicant.ds.xml
    Code:
    <DataSource ID="applicant">
      <fields>
        <field name="name" type="text" />
        <field name="address" type="address" />
      </fields>
    </DataSource>
    address.ds.xml
    Code:
    <DataSource ID="address">
      <fields>
        <field name="line1" type="text" />
        <field name="line2" type="text" />
        <field name="city" type="text" />
        <field name="state" type="enum">
            <valueMap>...</valueMap>
        </field>
        <field name="zip" type="text" />
      </fields>
    </DataSource>
    I'm creating my DynamicForm from the application DS instance...
    Code:
    isc.DynamicForm.create({dataSource:application});
    This includes everything in 'application' and 'applicant' accept the address. It doesn't seem like the NestedEditor created for 'applicant' is creating another NestedEditor for 'address'. NestedEditor uses a DynamicForm for it's internal editor, so I think it should work the same as at the root-level.

    Is this expected behavior or a "feature"?

    Maybe I don't understand the SmartClient DataSource architecture correctly. I'm separating my logical objects into separate datasources because they are resued multiple times in the root application datasource (for example, there's actually 2 applicant instances in my real model).

    Thanks,
    --mgbowman

    PS: I know about the "flattened data model" example, but this requires me to repeat the same model properties multiple times with different names and xpaths. Trying to follow the DRY principle :-/
    Last edited by mgbowman; 9 Aug 2010, 02:26. Reason: Figured it out on my own.
Working...
X