[pve-devel] [PATCH widget-toolkit] save index on keydown and check on keyup

Dominik Csapak d.csapak at proxmox.com
Wed May 2 15:28:26 CEST 2018


so that the edit window does not open again when pressing enter

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 grid/ObjectGrid.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/grid/ObjectGrid.js b/grid/ObjectGrid.js
index 68937ce..36c873c 100644
--- a/grid/ObjectGrid.js
+++ b/grid/ObjectGrid.js
@@ -225,10 +225,17 @@ Ext.define('Proxmox.grid.ObjectGrid', {
     },
 
     listeners: {
-	itemkeyup: function(view, record, item, index, e) {
+	itemkeydown: function(view, record, item, index, e) {
 	    if (e.getKey() === e.ENTER) {
+		this.pressedIndex = index;
+	    }
+	},
+	itemkeyup: function(view, record, item, index, e) {
+	    if (e.getKey() === e.ENTER && index == this.pressedIndex) {
 		this.run_editor();
 	    }
+
+	    this.pressedIndex = undefined;
 	}
     },
 
-- 
2.11.0





More information about the pve-devel mailing list