Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Blank row is inserted on click of Enter key

SA-23912

Summary



On Repeating layouts, a new blank row is inserted when Enter is clicked.

Error Messages



Not Applicable

Steps to Reproduce



1. Add a Grid or Row Repeat.
2. Click Enter key in the grid row.

Root Cause



This is an expected behavior because on click of enter key in any row a new row gets appended.

Resolution



Include the below code snippet for repeat grid:

<script>  var orig = pega.ui.grid.prototype.gridEventHandler;
 
pega.ui.grid.prototype.gridEventHandler = function(e,container)
{
console.log("test");
var eventType = e.type;
var Event = pega.util.Event;
var target  = Event.getTarget(e);
var eventKeyCode = e.keyCode;
debugger;
 
var isContextMenuOpen = this.isCtxtMenuOpen();
 
if(( eventType=="keypress" && eventKeyCode==13) )
{
if(!(this.bTreegrid && (Dom.hasClass(target, "expandNode") || Dom.hasClass(target, "collapseNode"))) && !isContextMenuOpen) {                                         
/* can improve the if conds  if needed */
  debugger;          
if(target && (target.type=="CHECKBOX" || target.type=="radio" ||  target.tagName=="SELECT"))
        Event.stopPropagation(e);
else
        Event.stopEvent(e);
}
}
 
if(eventKeyCode!=13)
{
orig.call(this,e,container);
}
 
}
</script>


Note: The above script does not work for row repeat as there is onKeyPress for every <tr>.

Published June 7, 2016 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

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

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us