Expand my Community achievements bar.

SOLVED

optionsProvider value not getting updated dynamically

Avatar

Level 2

Hi,

My requirement is to dynamically change the list in dropdown2 based on value selected in dropdown1 in Classic UI. I have 2 events configured to the listener in dropdown1. "loadcontent" and "selectionchanged". Below is the code snippet for listener event "selectionchanged". I have created a generic list through acs-commons and is using that as json data for optionsProvider.

 

selectionchanged="function(comp,val) {
var panel = comp.findParentByType('panel');

var textColor = panel.getComponent('textColor');

 

const colorMap = {
'bg-white':'all',
'bg-grey':'all-grey',
'bg-red':'black-only',
'bg-green':'black-only',
'bg-blue':'black-only',
'bg-yellow':'black-only'
};


var finalURL = '/etc/acs-commons/lists/' + colorMap[val] + '-text-color/_jcr_content.list.json';
console.log('Matching color is ',colorMap[val]);
eyebrowTextColor.optionsProvider = function(){
console.log(CQ.Util.eval(finalURL));
return CQ.Util.eval(finalURL);
}();
}"

 

The control goes inside eyebrowTextColor.optionsProvider = function(){}, and even prints the desired value in console. ie, console.log(CQ.Util.eval(finalURL)); But the options are not getting updated.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

I know you are looking for this for classic UI but I did same for touch UI https://aemlab.blogspot.com/2022/01/aemaacs-touch-ui-dialog-dynamic-dropdown.html, in case if this helps to understand the concept. 



Arun Patidar

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi,

I know you are looking for this for classic UI but I did same for touch UI https://aemlab.blogspot.com/2022/01/aemaacs-touch-ui-dialog-dynamic-dropdown.html, in case if this helps to understand the concept. 



Arun Patidar