Hi all,
I'm building a dashboard composed of multiple "modules," each with its own settings and parameters. Some of these parameters share common names, such as xRunning
and ModeHMI
. To manage these efficiently, I've used embedded views and passed the necessary props from parent to child where applicable.
To avoid manually adding every prop for every module, I created a module template and duplicated it for each module. My goal is to dynamically add the common properties.
Currently, I’m using an expression statement with the property()
method, combined with a custom property on the module's view that specifies the module name. For example:
property("view.params."+{view.custom.module_name}+".ModeHMI")
The reason for why {view.custom.module_name}
is necessary is because the params of each module/view are wrapped as a JSON object as this makes it MUCH easier to manage the params. e.g. where module_name = AnodeControl
AnodeControl {
"ModeHMI": 0,
"xRunHMI": 0,
"xRunning": 0,
}
This works well for displaying information in labels, but I also need to enable bidirectional binding to write back to the parameters. Directly using tags isn’t an option, as the tags are further up the embedded view chain.
Does anyone know if this kind of functionality is achievable?
Thank you!