I'm looking to change an internal Roomle parameter from externally from a webpage. I have 3 icon menus within roomle, the webpage that the Roomle is hosted on has users logins, so depending on who has logged in I want to hide certain Roomle Icons Menus, for example if Person1 is logged in I want to set the internal Roomle parameter of allowSplinta==true, allowCB==true, allowTB==true but if Person2 is logged in I want to set allowSplinta==false, allowCB==true, allowTB==false, so Person2 will only see 1 icon menu.
I see from the documentation this seems to be possible but unsure how to implement it, there is a section on the roomle site "Parameter Implementation outside of the configurator iFrame"
As you mentioned there is a section in the docs which explains this.
Basically you have to make sure the configuration is loaded (await loadObject) and then get all the parameters using your configurator instance:
const params = await configurator.extended.getParametersOfRootComponent();
If you know which parameter you want you can search it in the params array:
const viewParam = params.find(({key}) => key === 'door');
All valid values for this parameter are then stored in validValues (viewParam.validValues).
You can then use setParameterOfRootComponent to set the desired value:
configurator.extended.setParameterOfRootComponent(viewParam, value)
I created a CodeSandbox where you can take a look at the full example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With