3

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"

Michael Todd
  • 211
  • 1
  • 3

1 Answers1

1

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.

teh.fonsi
  • 3,040
  • 2
  • 27
  • 22
  • Thanks for this, looks great, have swapped in a few bits of code to test. So for example I have a parameter in the ROOT part called COMPANY, it has a list of ValidObjects, if I wanted to set the COMPANY to a different validObject what would the syntax be... – Michael Todd Feb 25 '21 at 12:58
  • configurator.extended.setParameterOfRootComponent(company, 'Rack Systems') – Michael Todd Feb 25 '21 at 12:59
  • 1
    All Sorted (I think)!! many thanks for your help! – Michael Todd Feb 25 '21 at 13:50