Parameter outside of the configurator
Parameter implementation outside of the configurator iFrame
Intro
Who should use this functionality?
How can this be implemented with API
Code
(async function() {
const minWidth = '10rem';
// be aware that you use the "extended" object, this needs to be included in your licence
// if you are unsure please ask your Roomle Rubens Contact person
const params = await configurator1.extended.getParametersOfRootComponent();
const viewParam = params.find(({key}) => key === 'door');
if (!viewParam) {
console.warn('Configuration has no door param');
return;
}
const parent = document.querySelector('.configurator-container').parentNode;
if (!parent) {
console.warn('No Roomle Configurator found');
return;
}
const wrapper = document.createElement('div');
viewParam.validValues.forEach(({value, label}) => {
const button = document.createElement('div');
const span = document.createElement('span');
span.innerText = label;
span.classList.add('btn', 'btn-primary');
span.style.minWidth = minWidth;
span.style.marginBottom = '1rem';
button.appendChild(span);
// be aware that you use the "extended" object, this needs to be included in your licence
// if you are unsure please ask your Roomle Rubens Contact person
button.addEventListener('click', () => configurator1.extended.setParameterOfRootComponent(viewParam, value));
wrapper.appendChild(button);
});
parent.style.display = 'grid';
parent.style.gridTemplateColumns = '1fr ' + minWidth;
parent.style.gridGap = '10px';
parent.appendChild(wrapper);
}());Last updated