Support Article
Option selected is reset from dropdown within section in grid
Summary
When user is using cascading dynamic select and target dynamic select is set to option value instead of "Option display", then property value is displayed instead of display option in dynamic select.
Error Messages
Not Applicable.
Steps to Reproduce
1) Create a cascading dynamic select in repeat grid.
2) In the target DS, configure different properties for Property for Option Display and Property for Option Value.
Root Cause
A software use or operation error
In the user case after reload section, focus is shifting to the next UI element. Because of this, dynamic select options are not populating until user hover or focus on the dynamic select as we set the load mode as "OnDemand". This is expected behavior with the load mode "OnDemand". But user wants to populate the options to show the selected option in the dynamic select.
Resolution
Here is the local-change which explicitly sets the focus on the "OnDemand" dynamic selects.
User can add the dynamic select ids list which requires auto populate options even in "OnDemand" mode. This script can be included inside userworkform.
<script>
if(typeof(pega.u)!="undefined" && typeof(pega.u.d)!= "undefined" ) {
pega.u.d.attachOnload(DS_setOnDemandEventsOriginalOverride, true);
} else {
pega.util.Event.addListener(window, "load", DS_setOnDemandEventsOriginalOverride);
}
function DS_setOnDemandEventsOriginalOverride(refreshElement) {
setTimeout(function(){
var _DSElemtsList = ["OccupancyTypeID", "ConstructionClassID"];
if(refreshElement.tagName && refreshElement.id =="RULE_KEY" ){
for(var i =0 ;i<_DSElemtsList.length;i++){
var elements = pega.util.Dom.getElementsById(_DSElemtsList[i],refreshElement,"select");
if(elements && elements.length == 1 && !elements[0].disabled ){
var selOpt = elements[0].options[elements[0].selectedIndex];
if(selOpt && selOpt.text == "null")
elements[0].focus();
}
}
}
},0);
}
</script>
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.