Support Article
Issuess with pxRadioButton control when used in Repeating-Grid.
SA-38958
Summary
1. The OnChange action-events, Refresh-ThisSection or Post-Value when specified on pxRadioButton do not get triggered/executed during Runtime.
2. The selection made by the user by clicking on pxRadioButton control does not get posted to the Clipboard. Only when the user navigated back and forth between two pages, the selected values are getting updated in the clipboard.
3. When the grid has pagination enabled, user is able to select one row per page from the corresponding list. But, user wants to select a single row for whole Repeating grid and in-order to achieve this, the selected value must get posted to the clipboard. However, this does not happen at present.
Error Messages
Not Applicable
Steps to Reproduce
1. Create a section rule and include a Repeating Grid. Enable Pagination.
2. Specify a source Page-list property having valid data to populate the grid with multiple pages.
3. Include pxRadioButton control in one of column and specify a source property.
4. Launch the section rule and select the RadioButton control.
Note: Implementation is also available in the Cloud instance. Follow the below steps:
1.Launch cloud URL: http://abpkk-27.pegacloud.com:9080/prweb/PRServlet/
2.Log in using credentials poc_operator/rules
3.In the left navigation pane, launch the WO S-989 by clicking on it.
Root Cause
This is a custom request based on Out-of-the-box (OOTB) PRPC function.
Resolution
Apply following solution:
1. Create an Activity @baseclass.SetOtherRadioToFalse in server with one Java step and paste the following:
String propertyReference = tools.getParamValue("propRef");
// Get the property name
String propertyName = propertyReference.substring(propertyReference.lastIndexOf('.') + 1);
// Get the page list name
String rowPageRef = propertyReference.substring(0, propertyReference.lastIndexOf('.'));
String pageListRef = rowPageRef.substring(0, propertyReference.lastIndexOf('('));
int rowNumber = Integer.parseInt(rowPageRef.substring(propertyReference.lastIndexOf('(') + 1, propertyReference.lastIndexOf(')')));
// oLog.error(pageListRef + " | " + rowNumber + " | " + propertyName);
Iterator plIterator = tools.getProperty(pageListRef).iterator();
while(plIterator.hasNext()) {
ClipboardPage rowPage = ((ClipboardProperty) plIterator.next()).getPageValue();
if (rowPage.getReference().equals(rowPageRef)) {
rowPage.getProperty(propertyName).setValue(true);
} else {
rowPage.getProperty(propertyName).setValue(false);
}
}
2. Add "Show-Property" step with Property: "true" value to above.
3. Override the setOtherRadioToFalse JS function provided by repeat grid to enhance it to call an Activity in server that maintains the radio buttons states for them. Add the following snippet in the UserWorkForm:
< script>
pega.u.d.attachOnload(function() {
if (pega.ui && pega.ui.grid) {
pega.ui.grid.prototype.setOtherRadioToFalse = function(element, event) {
var currentName = element.name;
if (typeof(element.id) == "undefined" || element.id == "")
element.id = currentName.replace(/[\d]/g, "");
var radioButtonsList = pega.util.Dom.getElementsById(element.id, this.gridDiv);
var len = radioButtonsList.length;
for (var i = 0; i < len; i++) {
if (radioButtonsList[i]) {
if (radioButtonsList[i].name != currentName) {
radioButtonsList[i].checked = false;
}
}
}
var currentRowRef = pega.ui.property.toReference(element.name);
// console.log(currentRowRef);
var activityUrl = SafeURL_createFromURL(pega.u.d.url);
activityUrl.put("pyActivity", "@baseclass.SetOtherRadioToFalse");
activityUrl.put("propRef", currentRowRef);
pega.u.d.asyncRequest("POST", activityUrl);
};
}
}, true);
< /script>
Published October 10, 2017 - 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.