[pmg-devel] [PATCH widget-toolkit 1/1] allow pressing enter in ObjectGrids to edit a field

Dominik Csapak d.csapak at proxmox.com
Fri Apr 6 13:22:44 CEST 2018


for this we need to overwrite the 'run_editor' function
of the ObjectGrid if we use a custom one

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 grid/ObjectGrid.js | 8 ++++++++
 node/DNSView.js    | 1 +
 node/TimeView.js   | 1 +
 3 files changed, 10 insertions(+)

diff --git a/grid/ObjectGrid.js b/grid/ObjectGrid.js
index bd294c8..68937ce 100644
--- a/grid/ObjectGrid.js
+++ b/grid/ObjectGrid.js
@@ -224,6 +224,14 @@ Ext.define('Proxmox.grid.ObjectGrid', {
 	return value;
     },
 
+    listeners: {
+	itemkeyup: function(view, record, item, index, e) {
+	    if (e.getKey() === e.ENTER) {
+		this.run_editor();
+	    }
+	}
+    },
+
     initComponent : function() {
 	var me = this;
 
diff --git a/node/DNSView.js b/node/DNSView.js
index 2df2dac..b0f0973 100644
--- a/node/DNSView.js
+++ b/node/DNSView.js
@@ -20,6 +20,7 @@ Ext.define('Proxmox.node.DNSView', {
 	    url: "/api2/json/nodes/" + me.nodename + "/dns",
 	    cwidth1: 130,
 	    interval: 1000,
+	    run_editor: run_editor,
 	    rows: {
 		search: { header: 'Search domain', required: true },
 		dns1: { header: gettext('DNS server') + " 1", required: true },
diff --git a/node/TimeView.js b/node/TimeView.js
index 0cf68eb..27de02d 100644
--- a/node/TimeView.js
+++ b/node/TimeView.js
@@ -26,6 +26,7 @@ Ext.define('Proxmox.node.TimeView', {
 	    url: "/api2/json/nodes/" + me.nodename + "/time",
 	    cwidth1: 150,
 	    interval: 1000,
+	    run_editor: run_editor,
 	    rows: {
 		timezone: { 
 		    header: gettext('Time zone'), 
-- 
2.11.0




More information about the pmg-devel mailing list