Skip to main content

How-to: Modify Hardcoded Drop-down Menu Items in Applet

Issue:

Is it possible to modify parameters hardcoded in a drop-down list? Furthermore, is it possible to connect that to a param_group as this would make it easier for other admins to update options without needing to edit the code?

Solution:

Yes, it is possible.

  • Use /api/param_groups endpoint in the applet and this could be tested using /main/static/util.html (see screenshot below for reference)

22887721419923-mceclip1.png
  • Create a param_groups.yml in content/admin, add in the dropdown values in the format as below:

- Volume-Units:
    μL: μL
    mL: mL

- Volume:
    100: 100
    200: 200
    300: 300
  • And the param ‘Volume-units’ can be ESP expressions:

- Vol. Units:
        dropdown: "{{ list(params('Volume-Units').values()) }}"
  • Ensure param_group.yml file is added in roles/seed/content.yml file so that it is automatically seeded

- model: paramgroup
  data: $LAB7DATA/content/admin/param_groups.yml
  • The same can be done via the UI as well - a detailed description for the same is available in ESP Documentation at https://<esp_url>/doc/admin-guide/admin-guide.html#manage-param-groups