Mark_VG
(Mark)
March 7, 2023, 10:21am
1
Hi All
Is there a way to clearVariable
for more than one variable in an oh-button
component?
slots:
default:
- component: oh-button
config:
clearVariable: selectedPartitionP
popupClose: .modal-in
have tried (as an array - flyer?):
clearVariable: "{selectedPartitionP, Bypass}"
Have not been able to find anything by searching.
Thanks
Mark
hmerk
(Hans-Jörg Merk)
March 7, 2023, 10:27am
2
You can try the solution poste by @JustinG here:
Since the beginning of MainUI this question has cropped up with some regularity: Can I trigger more than one of the OH widget actions on a component with a single click?
The answer has always, rightly, been: No, you can only define a single action for each component in a widget.
This answer is not 100% true, there are ugly hacks that could allow a click on a link, for example, to trigger the actions of other components, but these are not truly supported nor even advised.
The question (and def…
JustinG
(JustinG)
March 7, 2023, 1:52pm
3
An array is the correct option here, you just didn’t properly set an array. The easiest way to do so is just use the yaml array fromat:
- component: oh-button
config:
clearVariable:
- selectedPartitionP
- Bypass
popupClose: .modal-in
But sometimes it’s easier to use an expression if the array is supposed to be dynamic. Arrays in js syntax use [...]
you used {...}
which is for an object (you also forgot the =
to start the epxression).
- component: oh-button
config:
clearVariable: =['selectedPartitionP', 'Bypass']
popupClose: .modal-in
1 Like
Mark_VG
(Mark)
March 7, 2023, 5:42pm
4
Thanks Justin.
If I had thought to look fir yaml array instead of openhab aray etc i might have gotten there.
You may actually have told me before…