Generate controls based on reference data

What you'll be learning:

  • How to set up dynamic list controls that generate their child controls via data binding

    A schematic overview of a dynamic list control.

    Figure 79. A schematic overview of a dynamic list control.


In a dynamic list control, you only need to declare a template for the generated child elements. The dynamic list control will generate the template that you set up inside for each row returned by the query specified in its generator attribute.

You've already coded dynamic list controls in the data-binding tutorial.

In the previous tutorial, you linked the choices for a drop-down control to reference data. Now, you'll bind the popup panels in vehicleInspection.form.xml to the parts reference table.

Because these panels have label and segmented control child elements, this will make the number and values of the labels and the number of segmented controls that appear in the form dependent on the reference data in the table.

The segmented controls have a static query (the text Yes and No), so the reference data that their parent links to will not determine their value, only how many will be generated.

In this section of the tutorial, you'll slowly but surely make the contents of the whole form dependent on a single reference table with the help of two dynamic list controls nested into each other, and some clever reference data filtering.

When you are done, the parts of the truck, the groups that they appear in in the form, and the optional parts that the driver can report about will come from the parts reference table, and the form will automatically update the controls and control values whenever the data in the reference table change.