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

Hitting enter in an editable repeating grid creates a new row

SA-9453

Summary



In section we have repeating grid for reserve, when we select a row of a particular accountline to update reserve, and hit 'enter' key ,a new row is added by default, which is OOTB functionality. No row should be added on hitting enter key.

Error Messages



No message just a row is added on screen.

Resolution



This issue is resolved through the following local change: 

Use the below code in a non-autogenerated section and include the same at the end of section containing the repeat grid.

<script>

var orig = pega.ui.grid.prototype.gridEventHandler;

pega.ui.grid.prototype.gridEventHandler = function(e,container)
{
var eventType = e.type;
var Event = pega.util.Event;
var target  = Event.getTarget(e);
var eventKeyCode = e.keyCode;


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 */
                        
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>

 

Published May 10, 2015 - 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