Change the field used for the heading of a group?

I have some json like

It is some nested json objects

site_groups → sites → equipment → points

I am using the default uischema generated like

{
    type: "VerticalLayout",
    elements: [
      {
        type: "Category",
        label: "name",
        elements: [
          {
            type: "Control",
            scope: "#/properties/site_group",
          },
          {
            type: "Control",
            scope: "#/properties/outputs",
          },
        ],
      },
    ],
  };

This displays ok except for the titles of the groups are wrong.
For example the points are displayed with the title in the dropdown of “unsigned int”
presumably because that was the first string field defined in the json ?

How can I changed the field used for this to the dis or name fields ?

Thanks

Hi @glennpierce,

You can use the “elementLabelProp” UI Schema option on a control for an array to use a different property than the first one within the JSON Schema.


Some notes:

  • Do you also auto generate the JSON Schema?
  • I’m a bit confused about your UI Schema. In the pasted example JSON site_group and outputs are on two different levels, so they should not have the same scope prefix.
  • The element “Category” should only be used within “Categories”, you probably want to use a “Group” there.
  • If you need to set a detail UI Schema then you can do so for example via the UI Schema options detail, e.g.
type: "Control",
scope: "#/properties/sites",
options: {
  detail: {
    type: "VerticalLayout",
    scope: "#/properties/equip",
    options: {
      detail: {
        // etc.
      }
    }
  }
}

I generated the Jsonschema from my json config using an oline service. I then manually entered an couple of area where enums were needed.

I grabbed the UISchema that the code generated. Perhaps I changed the json after grabbing the uischema. I had to move to another project for a while so possible I got lost in what I was doing.

Thanks