Hi,
i have a problem with oh-repeater and probably understanding the difference between the source types.
What i try to achieve is to be able to select multiple items and have them listed in a widget.
After spending a lot of time, searching online etc i tried a different approache with “itemsInGroup”
(This is a customized version of widget_f7-card_Temp_V2_Control btw)
- context: item
description: Contact Group
label: Contact Group
name: itemContactGroup
required: false
type: TEXT
slots:
default:
- component: oh-list
slots:
default:
- component: oh-repeater
config:
for: item
sourceType: itemsInGroup
groupItem: =[props.itemContactGroup]
fragment: true
slots:
default:
- component: oh-list-item
config:
icon: ='oh:' + loop.item.category
iconUseState: true
title: =loop.item.label
item: =loop.item.name
style:
color: black
When selecting a group (containing all contact items) i get this
This is kinda what i want. But i only want so select the specific items for the specific room
Here is the code i try to make work
- context: item
description: Door/Window contacts
label: Contact Items
name: itemContacts
required: false
type: TEXT
multiple: true
slots:
default:
- component: oh-list
slots:
default:
- component: oh-repeater
config:
for: item
sourceType: array
in: =props.itemContacts
fragment: true
slots:
default:
- component: oh-list-item
config:
icon: ='oh:' + loop.item.category
iconUseState: true
title: =loop.item.label
item: =loop.item.name
style:
color: black
But this only gives me an empty list (can’t post more screenshots since i am new -_- )
Now the empty space below the Temp and Humidity will increase/decrease based on how many items i select.
I tried differnt ways of writing it but none gave me, for example, the “label”
If i change the title to
title: '=loop.item'
i get a list with the item names. (again sorry can’t post another screenshot)
loop.item.name / .state will return nothing. Now
title: '=items[loop.item].state'
will return the states. But i can’t seem to access category / label etc.
I am really lost here. Isn’t a multiple: true selection supposed to behave like a group?
What can i do to make this code work? Or does someone know a widget that already does this?
TIA
Mike