Question on fetchMetaData in oh-repeater

Question regarding use of fetchMetaData in oh-repeater
In the example on github, fetchMetadata: semantics,widgetOrder has been used for oh-repeater for sourceType: itemsInGroup and sourceType: itemsWithTags

  1. What is the use / how to use the semantics metadata in the iterated children. e.g., can we somehow use the values or config stuff of the semantics metadata?
    "metadata": {
        "semantics": {
          "value": "Point_Status",
          "config": {
            "relatesTo": "Property_Presence",
            "hasLocation": "Devices_Online"
          }
        }
      }
  1. extending this, is there any possibility of writing fetchMetadata: listWidget and using the values from within this? e.g., the title or subtitle value below
"metadata": {
    "listWidget": {
      "value": " ",
      "config": {
        "title": "XXXX Cloud Item",
        "subtitle": "MQTT topic 'status' on XXXX.yyyy"
      }
    }
  }

Hi @ysc
May I request your thoughts on this?
Thanks

Sure, that’s the idea. The item in the iterator variable will include the metadata.

component: f7-card
slots:
  default:
    - component: oh-list
      config:
        mediaList: true
      slots:
        default:
          - component: oh-repeater
            config:
              fragment: true
              for: item
              sourceType: itemsInGroup
              groupItem: FlowerCare
              filter: =loop.item.metadata && loop.item.metadata.semantics
              fetchMetadata: semantics
            slots:
              default:
                - component: oh-list-item
                  config:
                    icon: ='oh:' + loop.item.category
                    title: =loop.item.label
                    subtitle: =loop.item.metadata.semantics.value
                    footer: =loop.item.metadata.semantics.config.relatesTo
                    after: =loop.item.state

image

(really should stick that thing back in the pot!)

1 Like

Thank you! this is very powerful :slight_smile:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.