Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write to Roomle parameter from external page

Tags:

roomle

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"

like image 304
Michael Todd Avatar asked Feb 02 '26 02:02

Michael Todd


1 Answers

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.

like image 132
teh.fonsi Avatar answered Feb 04 '26 01:02

teh.fonsi