ParamQuery grid support forum

General Category => Bug Report => Topic started by: luckduck on April 10, 2026, 11:20:05 am

Title: ESC does not restore value after Delete in editor mode (v11)
Post by: luckduck on April 10, 2026, 11:20:05 am
Hello,

I noticed a difference in behavior between pqGrid v9 and v11.

1. In pqGrid v9:
When a cell is in editor mode, if I press the Delete key to clear the content and then press ESC, the original value is restored.

2. In pqGrid v11:
After pressing the Delete key, the cell value is already removed, and pressing ESC does not restore the original value.

Could you please confirm if this is an intended change or a bug?

This behavior can also be reproduced on the demo site.

pqGrid9 (https://paramquery.com/pro/demos91/editing_instant)

pqGrid11 (https://paramquery.com/pro/demos/editing_instant)

Thank you.
Title: Re: ESC does not restore value after Delete in editor mode (v11)
Post by: paramvir on April 12, 2026, 09:47:09 pm
Thanks for reporting the issue, it's a bug and its fix is in progress.
Title: Re: ESC does not restore value after Delete in editor mode (v11)
Post by: luckduck on April 14, 2026, 07:17:02 am
I have an additional question regarding another issue.

In my environment, I am using the treeModel. When the summaryInTitleRow option is enabled, pressing the Delete key while the editor is active causes the editor to close immediately.

Due to this, combined with the previously mentioned issue, the original cell data is already removed, and the validation logic is triggered twice, resulting in behavior that differs from pqGrid version 9.

As a result, the existing data in the cell is completely cleared, and the editor is closed, leading to total data loss.

I am not sure if the issue with the editor closing on the Delete key should be considered in the same context, but since it is affecting our production system, a quick resolution is required.

If there is a solution, I would greatly appreciate it if you could share it along with example source code.

Thank you.
Title: Re: ESC does not restore value after Delete in editor mode (v11)
Post by: paramvir on April 14, 2026, 08:51:26 am
Both issues are related; I'll share the fix soon.
Title: Re: ESC does not restore value after Delete in editor mode (v11)
Post by: paramvir on April 14, 2026, 10:36:53 am
To resolve this issue, please include the following patch in your project. It must be loaded after the pqgrid.js library to function correctly.

Code: [Select]
!function(e){e(document).off(".pqExcel").on("keydown.pqExcel",function(c){var t,n,i=e(document.activeElement),l=i.parent(),o=l.is(".pq-focus-mgr:not(.pq-editor-outer)"),r=o,p=c.key,E=c.keyCode,u=e.ui.keyCode,g=e=>{t=i.closest(".pq-grid"),n=t.pqGrid("instance")};if(!o||E!=u.UP&&E!=u.DOWN||c.preventDefault(),o&&E==u.DELETE&&(g(),n?.clear()),pq.isCtrl(c)&&r&&(g(),gExcel||i.length&&n)){if(!gExcel)try{if(n.options.selectionModel.native)return!0;gExcel=new cExcel(n)}catch(e){return!0}i=gExcel.initClip(i,l),"f"!=p&&"F"!=p||e(document).trigger("keyup.pqExcel")}}).on("keyup.pqExcel",function(e){if(!pq.isCtrl(e)&&gExcel){gExcel=null}}).on("click.pqExcel keydown.pqExcel",function(c){"click"!=c.type&&e.ui.keyCode.ENTER!=c.keyCode||e(c.target).trigger("pq:clickE")})}(jQuery);

Kindly let me know if you need further assistance.
Title: Re: ESC does not restore value after Delete in editor mode (v11)
Post by: luckduck on April 15, 2026, 06:03:01 am
 The code you provided works correctly.
However, I encountered the following error: Uncaught ReferenceError: gExcel is not defined

So I added a declaration for gExcel like below.
Could you please confirm if this is the correct approach?

Code: [Select]
!function(e){var gExcel = null;e(document).off(".pqExcel").on("keydown.pqExcel",function(c){var t,n,i=e(document.activeElement),l=i.parent(),o=l.is(".pq-focus-mgr:not(.pq-editor-outer)"),r=o,p=c.key,E=c.keyCode,u=e.ui.keyCode,g=e=>{t=i.closest(".pq-grid"),n=t.pqGrid("instance")};if(!o||E!=u.UP&&E!=u.DOWN||c.preventDefault(),o&&E==u.DELETE&&(g(),n?.clear()),pq.isCtrl(c)&&r&&(g(),gExcel||i.length&&n)){if(!gExcel)try{if(n.options.selectionModel.native)return!0;gExcel=new cExcel(n)}catch(e){return!0}i=gExcel.initClip(i,l),"f"!=p&&"F"!=p||e(document).trigger("keyup.pqExcel")}}).on("keyup.pqExcel",function(e){if(!pq.isCtrl(e)&&gExcel){gExcel=null}}).on("click.pqExcel keydown.pqExcel",function(c){"click"!=c.type&&e.ui.keyCode.ENTER!=c.keyCode||e(c.target).trigger("pq:clickE")})}(jQuery);
Title: Re: ESC does not restore value after Delete in editor mode (v11)
Post by: paramvir on April 15, 2026, 08:31:28 am
Thanks for the correction!

Yes, that is the correct approach for resolving ReferenceError when a variable is being accessed but has not been declared within the scope.