optionsProvider value not getting updated dynamically | Community
Skip to main content
Level 2
January 2, 2023
Solved

optionsProvider value not getting updated dynamically

  • January 2, 2023
  • 1 reply
  • 588 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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. 

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
January 2, 2023

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