]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - grid/ObjectGrid.js
save index on keydown and check on keyup
[proxmox-widget-toolkit.git] / grid / ObjectGrid.js
index 5e6737429e2bbf0a747b47847b54ac2f6565b94f..36c873c56a3790d48a55b546db3a8ae61a72a453 100644 (file)
@@ -38,6 +38,9 @@ Ext.define('Proxmox.grid.ObjectGrid', {
            editor: {
                xtype: 'proxmoxWindowEdit',
                subject: text,
+               fieldDefaults: {
+                   labelWidth: opts.labelWidth || 100
+               },
                items: {
                    xtype: 'proxmoxKVComboBox',
                    name: name,
@@ -67,6 +70,9 @@ Ext.define('Proxmox.grid.ObjectGrid', {
            editor: {
                xtype: 'proxmoxWindowEdit',
                subject: text,
+               fieldDefaults: {
+                   labelWidth: opts.labelWidth || 100
+               },
                items: {
                    xtype: 'proxmoxtextfield',
                    name: name,
@@ -95,6 +101,9 @@ Ext.define('Proxmox.grid.ObjectGrid', {
            editor: {
                xtype: 'proxmoxWindowEdit',
                subject: text,
+               fieldDefaults: {
+                   labelWidth: opts.labelWidth || 100
+               },
                items: {
                    xtype: 'proxmoxcheckbox',
                    name: name,
@@ -120,9 +129,13 @@ Ext.define('Proxmox.grid.ObjectGrid', {
            required: true,
            defaultValue: opts.defaultValue,
            header: text,
+           renderer: opts.renderer,
            editor: {
                xtype: 'proxmoxWindowEdit',
                subject: text,
+               fieldDefaults: {
+                   labelWidth: opts.labelWidth || 100
+               },
                items: {
                    xtype: 'proxmoxintegerfield',
                    name: name,
@@ -211,6 +224,21 @@ Ext.define('Proxmox.grid.ObjectGrid', {
        return value;
     },
 
+    listeners: {
+       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;
+       }
+    },
+
     initComponent : function() {
        var me = this;