Using action: options on an item makes a selection menu pop up when selected.
It presents all the item’s options as a button list of choices with a blue label, plus a separate ‘Cancel’ button with red text.
I’d like to change those selection label colors, but could not find out to date how to. Any idea?
config:
action: options
actionItem: =loop.selection.actionItem
item: =loop.selection.actionItem
style:
margin-left: auto
margin-right: auto
visible: =loop.selection.visible
This is actually a non-trivial task. Those options are setup as an f7 action sheet, which means that they are one of the f7 modal types. The reason this impacts you is that the f7 modals are rendered in a portion of the page that is out of the scope of the widget custom css so you can’t really impact their styling directly. There also aren’t any options that I’m aware of that the user can set.
Pretty much the only way to get custom colors on that would be to build your own version in the widget. Here’s a sample that simulates the basic oh action sheet but with oh-link components that could have whatever oh action you want to set.
Clicking on the Custom options button opens an actions sheet that looks like this:
Add on to that the fact that the repeater does have an itemCommandOptions property that means you could loop through preset options for a supplied item to produce the buttons. That way you have a complete replica of the oh built-in options sheet but you now can control the color and whatever other style you want.
I’m working on a custom action sheet widget in OpenHAB, where users can select options from a list, and the selected option should be displayed as a label on the button. However, I’m running into an issue where the variable selectedValue doesn’t seem to update or display as expected.
The action sheet opens as expected, and the options are displayed correctly. However, when I select an option, the selectedValue variable doesn’t seem to be set, and it doesn’t display on the top button.
What I’ve Tried
Initializing selectedValue in Props: I tried adding selectedValue in props as a parameter to initialize it, but that didn’t solve the problem.
Checking the Display Path: I’ve confirmed that =vars.selectedValue is the correct syntax in other places, but it doesn’t seem to work here.
Debugging Variable Update: It’s unclear if the variable isn’t updating or if it’s just not displaying.
Questions
Does anyone have experience with setting and displaying actionVariable values in widgets?
Is there something I’m missing in terms of variable scope or syntax that would allow selectedValue to update and display correctly?
Could there be an alternative approach to achieve this type of action sheet with variable display?