Built-in List Control Editors in a Form View

Description

You can create built-in list controls to use inside an editor that edits items in a Form View control. Because the 'Editor-List' is an editor only one of these controls needs to be defined in order for multiple items to make use of it. The example below uses an Editor-List to edit the 'City' and 'Country' fields. You can easily add filters to items that use an editor so that, for example, an editor-list that shows cities will only show cities that apply to the selected country in a Form View.

A Built-in List control (lower right) selects cities filtered by country to enter into a FormView (lower left) and edit a list (top).
A Built-in List control (lower right) selects cities filtered by country to enter into a FormView (lower left) and edit a list (top).

How to create a Built-in list in a Form View control is described in the guide below and in this video. You can also download the component.

Create a List Control

  1. In the UX Builder on the UX Controls page open the Data Controls menu. Click on the [List] option to add a list control to the component.

    Bilc2
  2. In the properties list's List Properties section click the ... button next to the 'List properties' property to open the List Builder.

    Bilc3
  3. On the List Builder's Data Source pane set the 'Data Source Type' to 'SQL'.

    Bilc4
  4. In the SQL Data Source section click the ... button next to the 'Connection string' property. Set the connection string to the 'Northwind' database.

    Bilc5
  5. Click the ... button next to the 'Table name' property and select the 'Customers' table.

    Bilc6
  6. Click the ... button next to the 'Field list' property and select these fields: 'CustomerID', 'CompanyName', 'ContactName', 'City', and 'Country'.

    Bilc7
  7. Open the 'List Layout' pane. Use the blue > arrow to move the five data fields from the 'Available Fields' list into the 'Columns in List' section. Click OK to close the List Builder.

    Bilc8

Add the FormView Control and EditorSet

  1. On the UX Controls page, select the list control. Open the 'Other Controls' menu and click on the [Form View] option to add a Form View control to the component.

    Bilc9
  2. Select the form view control in the tree. Open the 'Containers' menu and click on the [Container] option.

    Bilc10
  3. From the Container type list select the 'EditorSet' option and click 'Insert After'.

    Bilc11
  4. Select the EditorSet in the tree. Open the Defined Controls menu and select the 'Editor-List' option. Give this Editor the name 'EDITOR_LIST'.

    Bilc12
  5. Select the EditorSet in the tree. From the Defined Controls menu select the 'Editor-TextBox' option. Use the default name and click OK.

    Bilc15
  6. Select entire EditorSet and everything inside it. Open the 'Containers' menu and click on the [Container] option.

    Bilc16
  7. From the 'Container type' list select the 'None' option and click 'OK'

    Bilc17

Adding to the Client-Side Data Cache

  1. On the UX Controls page click locate the 'Menu' dropdown in the Controls page toolbar. Click on the 'Client-side Data Cache Editor' option.

    Bilc18
  2. In the Client-side Data Cache Editor click on the 'Add item' button.

    Bilc19
  3. Name the new item 'cities' and click OK.

    Bilc20
  4. Select the cities item and click the 'Edit item' button.

    Bilc21
  5. From the Item type menu select the 'SQL Query' choice.

    Bilc22
  6. In the SQL Query section of the properties list that appears click the ... button next to the 'Connection string' property. Set the connection string to 'Northwind'.

    Bilc23
  7. Click on the ... button next to the 'Table name' property and select the 'Customers' table.

    Bilc24
  8. Click the ... button next to the 'Field list' property and select the 'City' and 'Country' fields.

    Bilc25
  9. Click the ... button next to the 'Order' property. Select the 'City' and 'Country' fields again. Make sure to separate the two fields with a comma.

    Bilc26
  10. Check the 'Distinct' checkbox and click OK.

    Bilc27
  11. Click the 'Add item' button.

    Bilc28
  12. Give the new item the name 'countries' and click OK.

    Bilc29
  13. Select the 'countries' item and click the 'Edit item' button.

    Bilc30
  14. In the 'Edit Client-side Data Item' select the 'SQL Query' option.

    Bilc31
  15. In the SQL Query section of the properties list click the ... button next to the 'Connection string' property. Create a connection string to the 'Northwind' database.

    Bilc32
  16. Click the ... button next to the 'Table name' property and select the 'Customers' table.

    Bilc33
  17. Hit the ... button next to the 'Field list' property and select the 'Country' field.

    Bilc34
  18. Click the ... button next to the 'Filter' property.

    Bilc35
  19. Define the following filter and click OK.

    Country<>''
    Bilc36
  20. Click the ... button next to the 'Order' property and select the 'Country' field.

    Bilc37
  21. Check the checkbox next to the 'Distinct' property and click OK to close the 'Edit Client-side Data Item' dialog. Click OK again to close the Client-side Data Cache Editor.

    Bilc38

Define the FormView

  1. On the UX Controls page, click the Form View control in the control tree.

    Bilc39
  2. In the properties list on the right click the ... button next to the 'Form properties' property in the Form Properties section. The Form View Builder should open.

    Bilc40
  3. On the Form View Builder's Data Source pane. Set the 'Datasource type' to 'List'.

    Bilc41
  4. Click the ... button next to the 'List name' property and select the list control 'list1'. Click OK.

    Bilc42
  5. Open the 'Form Layout' pane and click the 'Add item' button.

    Bilc43
  6. In the 'Select Control Type' dialog's Category menu select 'Data Controls'. In the Control menu select the [Label] option. Select all the data fields in the list on the right and click OK.

    Bilc44
  7. Click the 'Add item' button again.

    Bilc45
  8. In the 'Category' menu select 'Pre-defined Controls' option. From the 'Control' menu select [Save Form Edits/ Cancel Edits Button] option and click OK.

    Bilc46
  9. Open the Fields pane. Select the 'CUSTOMERID' field in the 'Fields in Data Source' menu.

    Bilc47
  10. Click the ... button next to the 'Editor set' property in the 'Editing' section of the properties list.

    Bilc48
  11. In the 'Select Editor' dialog select the 'EDITORSET_1' in the 'Editor Set' list and 'EDITOR_2' in the Editor list. Click the 'Assign selection to multiple fields' button.

    Bilc49
  12. Select the 'CustomerID', 'CompanyName', and 'ContactName' fields and click OK.

    Bilc50
  13. Select the 'City' field in the 'Fields in Data Source' list. Click the ... button next to the 'Editor set' property.

    Bilc51
  14. In the Select Editor choose the 'EDITORSET_1' option in the 'Editor Set' list. In the 'Editor' list select the 'EDITOR_LIST' option. Click the 'Assign selection to multiple fields' button.

    Bilc52
  15. Select the 'City' and 'Country' options and click OK.

    Bilc53
  16. In the 'Fields in Data Source' menu, click the 'City' field. In the properties list on the right. click the ... button next to the 'Editor configuration genie' property.

    Bilc54
  17. In the 'Form View Editor Configuration Genie' check the 'Show List column title(s)' property checkbox.

    Bilc55
  18. Click the ... button next to the 'Customize Titles' property.

    Bilc56
  19. Add the following code to the Custom Titles dialog and click OK:

    {
        "CITY": "Cities (for selected country)"
    }
    Bilc57
  20. Set the 'List data source' property dropdown to 'Client-side Data Cache'.

    Bilc58
  21. Click the ... button next to the 'Client-side data cache item' property and select the 'cities' item; that you defined in the previous section of this guide.

    Bilc59
  22. Click the ... button next to the 'Column(s) from data source to show in List' property.

    Bilc60
  23. Select 'Country' and 'City' and click OK.

    Bilc61
  24. Click the ... button next to the 'Return value' property. Set the Return value to be City

    Bilc62
  25. Check the "Hide the 'Cancel' button" checkbox.

    Bilc63
  26. In the 'Dynamic Filtering of LIST Choices section check the 'Filter LIST choices' checkbox.

    Bilc64
  27. Click the ... next to the 'Filter expression' property.

    Bilc66
  28. Click the 'Insert field name' button and select the 'Data field' option. Choose the 'Country' field.

    Bilc65
  29. Put two equals sign after the data field, '==', and click the 'Insert field name'. Click the 'Form field' option and select the 'Country' field again. The expression should look like this:

    data.Country == '{formData.Country}'
    Bilc67
  30. Click OK. Then click OK again. Select the 'Country' field in the 'Fields in Data Source' list.

    Bilc68
  31. Click the ... button next to the 'Editor configuration genie' property.

    Bilc69
  32. From the 'List data source' property's dropdown select 'Client-side Data Cache'.

    Bilc70
  33. Click the ... button next to the 'Client-side data cache item' property and select 'countries'.

    Bilc71
  34. Click the ... button next to the 'Fields to blank out on Form when user makes a selection in List' property. Set this property to 'City'

    Bilc72
  35. Click OK to close the genie and OK again to close the Form View Builder. Run the component in Live Preview.

    Bilc73
  36. Select a row in the list control. The Form View should appear.

    Bilc74
  37. Click on the Country field to edit it and you should be presented with a list of all of the countries in the data. Change the Country.

    Bilc75
  38. Try changing the 'City' field in the FormView. The editor-list control should filter the city options based on the selected country.

    Bilc76