Skip to content

React/Material ListWithDetail should support "labelRef" option #1824

Description

@cons0l3

Describe the bug

The layout ListWithDetail of the React-Material renderer does not honor the options.labelRef.

Expected behavior

When using the options.labelRef the list of items need to be rendered with that labelRef and not the first field of the schema as shown in the examples here (list-with-details.ts)

Steps to reproduce the issue

with a schema.json

      "beneficaries": {
         "title": "Beneficaries",
         "type": "array",
         "items": {
            "$ref": "#/definitions/Company"
         }
      }
...
      "Company": {
         "title": "Company",
         "type": "object",
         "properties": {
            "partner_id": {
               "title": "Partner Id",
               "type": "string",
               "format": "uuid"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "postal_address": {
               "$ref": "#/definitions/Address"
            }
         },
[...]

when defining a uischema.json with

{
          "type": "ListWithDetail",
          "scope": "#/properties/beneficaries",
          "options": {
            "labelRef": "#/properties/name",
            "detail": {
              "type": "VerticalLayout",
              "elements": [
                { "type": "HorizontalLayout", 
                  "elements":[
                    { "type": "Control", "scope": "#/properties/name" },
...

When inspecting the MaterialListWithDetailRenderer.tsx and the ListWithDetailMasterItem.tsx, I could not quite find out where the labelRef option comes into play.

Screenshots

No response

In which browser are you experiencing the issue?

all browsers

Framework

React

RendererSet

Material

Additional context

"dependencies": {
"@jsonforms/core": "^2.5.1",
"@jsonforms/material-renderers": "^2.5.1",
"@jsonforms/react": "^2.5.1",
"@material-ui/core": "^4.11.2",
"@material-ui/icons": "^4.11.2",
...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions