Support Article

Unable to delete grid item when page has errors

SA-34581

Summary



User has configured the Grid item with validation rules.

When user adds the multiple records in the grid and clicks on submit button without providing the values on the required fields as expected it showing all the error messages based on the configuration.

When server validation occurs and pyWorkPage has messages system behaves incorrectly.

For example, when user has error messages and click delete row for the first time, it moves to the top and actually delete this row.

But after that if user scrolls down and click try to delete another row, system will not delete this row and moves focus to the top.

From this point, grid is not responding on any actions, whether it is about adding item, deleting item or just clicking on any point inside grid.

Every click leads to moving focus on top.


Error Messages



Not Applicable

Steps to Reproduce



1. Create a grid with multiple validations.
2. Click Submit without filling the required fields and server side validation occurs.
3. Try to delete grid item, first time it works and then try to delete again and focus going to error messages without deleting the record.


Root Cause



A defect in Pegasystems’ code or rules

While adding new rows to grid, a focuslistener is being added to the grid.

So, on focus on gridrow, it is checking for errors and it is displaying errors on the top of harness and if errors exists automatically it is obtaining the focus.



Resolution



Create an embed section in parent section and disable Auto-Generated HTML checkbox under HTML tab(for the embed section) and add the code:

<script>
$(function() {
pega.ui.Doc.prototype.onfocusInListener = function(e){
var tar = e.target || e.srcElement;
varactiveName = tar.name;
if(tar.id === "RLDel") { /**Event is from Delete button, so no need to processInlineScripts in this case **/
return;
}
var parent = tar.parentNode;
while(parent.tagName !== "TR" || (parent.getAttribute("hPref") === null && parent.getAttribute("PL_INDEX") === null)){
parent = parent.parentNode;
if (parent === null){
break;
}
}
vari = 0;
varcurrNode = parent;

while (i < 2 && currNode) {
if(currNode) {
/*Check for the attribute contentUpdated with boolean and string as boolean works in IE and string works in FF*/
if(currNode.getAttribute("contentUpdated") == true || currNode.getAttribute("contentUpdated") == "true")
{
/* Replace $ in currHPref with \$ for string replacement */
varstrSelectUniqueID = "";
/* BUG-160432: Changing to getAttribute for browser compatibility */
if (typeof(this.reloadElement.getAttribute('uniqueID')) !== "undefined")
strSelectUniqueID = this.reloadElement.uniqueID;
else {
strSelectUniqueID = pega.util.Dom.generateId();
this.reloadElement.setAttribute("uniqueID", strSelectUniqueID) ;
}
varobjDOMLoader = new DOMScriptLoader();
varoldCallback = pega.tools.EvalDomUtils_globals.callbackFunction;
pega.tools.EvalDomUtils_globals.callbackFunction = pega.u.d.callbackForRepeat;

objDOMLoader.processInlineScripts(this.reloadElement,currNode,strSelectUniqueID,true);
pega.tools.EvalDomUtils_globals.callbackFunction = oldCallback;

currNode.setAttribute("contentUpdated",false);
}
}/*ends currNode == TR*/
i++;
/*processInLineScripts for previous row so that it does not react to the actions on focussed row
*as now their innerHTML's have same entry handles
*/
currNode = pega.util.Dom.getPreviousSibling(currNode);
}/*ends while*/
}
});
</script>

Published March 6, 2017 - Updated July 11, 2017

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.