Metadata "options" -> oh-repeater

The oh-repeater iterates over each item and grabs it’s metadata - so it’s not a problem to grab all of them.

The function is part of the oh/f7-input component but you can’t pass arguments to it right now afaik, so yes, it’s not usable atm.

But there are alternatives like:

  1. Selection list in a separate popup - better for a lot of items and more mobile friendly (similar to the UI configuration selection)

    list_selection-1

Selection list #1 (YAML)
uid: selection_type-1
component: f7-card
config:
  title: "Selection type #1"
slots:
  default:
    - component: f7-row
      config:
        class:
          - padding
      slots:
        default:
          - component: oh-repeater
            config:
              sourceType: array
              for: selection
              in:
                - title: Input source
                  icon: f7:tv
                  item: testItem
                - title: Surround programs
                  icon: f7:music_note_list
                  item: testItem5
              fragment: true
            slots:
              default:
                - component: f7-col
                  slots:
                    default:
                      - component: oh-list
                        config:
                          id: list
                        slots:
                          default:
                            - component: oh-list-item
                              config:
                                title: =loop.selection.title
                                after: =items[loop.selection.item].displayState
                                smartSelect: true
                                icon: =loop.selection.icon
                                iconColor: default
                                popupOpen: =".selectionPopup_"+loop.selection_idx
                                style:
                                  border: 1px solid lightgray
                                  border-radius: 5px
                      - component: f7-popup
                        config:
                          class: ="selectionPopup_"+loop.selection_idx
                        slots:
                          default:
                            - component: f7-page
                              slots:
                                default:
                                  - component: f7-navbar
                                    config:
                                      title: =loop.selection.title
                                      style:
                                        position: sticky
                                    slots:
                                      left:
                                        - component: oh-link
                                          config:
                                            iconIos: f7:arrow_left
                                            iconMd: material:arrow_back
                                            iconAurora: f7:arrow_left
                                            popup-close: true
                                  - component: f7-list
                                    config:
                                      virtualList: true
                                    slots:
                                      default:
                                        - component: oh-repeater
                                          config:
                                            sourceType: itemStateOptions
                                            itemOptions: =loop.selection.item
                                            for: option
                                            fragment: true
                                          slots:
                                            default:
                                              - component: oh-list-item
                                                config:
                                                  title: =loop.option.label
                                                  actionFeedback: ='{ "text":"You selected <b>' + loop.option.label + '</b><br>Sending command <b>' +  loop.option.value + '</b> to item", "position":"center","icon":"<i style=\\"color:green\\" class=\\"f7-icons\\">checkmark_alt</i>","closeButton":true }'
                                                  noChevron: true
                                                  radio: true
                                                  checked: "=loop.option.value === items[loop.selection.item].state ? true : false"
                                                  popupClose: true
                                                  action: command
                                                  actionItem: =loop.selection.item
                                                  actionCommand: =loop.option.value
  1. Automatic generated list of options in an overlay (similar to the sheet mechanics)
    list_selection-2
Selection list #2 (YAML)
uid: selection_type-2
component: f7-card
config:
  title: "Selection type #2"
slots:
  default:
    - component: f7-card
      config:
        noShadow: true
        class:
          - no-margin
      slots:
        default:
          - component: f7-card-content
            config:
              class:
                - margin-top-half
            slots:
              default:
                - component: f7-list
                  slots:
                    default:
                      - component: f7-list-item
                        config:
                          title: Input source
                          after: =items.YOUR_SOURCE_ITEM.state
                      - component: f7-list-item
                        config:
                          title: Surround programs
                          after: =items.YOUR_SURROUND_ITEM.state
    - component: f7-row
      config:
        class:
          - padding
          - padding-top-half
      slots:
        default:
          - component: f7-col
            slots:
              default:
                - component: oh-button
                  config:
                    text: Input source
                    outline: true
                    action: options
                    actionItem: YOUR_SOURCE_ITEM
          - component: f7-col
            slots:
              default:
                - component: oh-button
                  config:
                    text: Surround programs
                    outline: true
                    action: options
                    actionItem: YOUR_SURROUND_ITEM

It is (I think) - but it would be too easy giving you a solution, so I think this is a good challenge for you, if the above variants doesn’t fit your needs. :slight_smile:

6 Likes