Use a non-url param field in ui breadcrumbs


#1

How can you set the crumbs.text field of UI breadcrumbs to use a field that is not part of the url params? I am looking to use the name field of an object rather than the id, but the name field is not necessarily a unique identifier, so it can’t be used as the url parameter


#2

You can set the text field to any field that is included in the dataSource for that page:

ui module myApp
  page ObjectDetails {
    "name": "ObjectDetails",
    "title": "{~myApp.page.ObjectDetails.title~}",
    "url": "objectDetails",
    "parentPageUrl": "/myApp/objects",
    "template": "myApp.ObjectDetails",
    "breadcrumbs": {
      "dependencyCrumbs": [
        {
          "pageId": "myApp.Objects",
          "link":  "/myApp/objects",
          "text": "Objects"
        }
      ],
      "crumbs": [
        {
          "link": "/myApp/objectDetails/{{ params.id }}",
          "text": "{{ name }}"
        }
      ]
    },
    "data": {
      "record": "myApp.SomeDataSource"
    },