]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
set default focus and default button for edit window
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 25 Apr 2017 04:17:22 +0000 (06:17 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 25 Apr 2017 04:17:22 +0000 (06:17 +0200)
this patch sets following defaults for the edit window:

defaultFocus: 'field'

sets the focus on the first field it finds in its child items,
works for most edit windows, so that the cursor stands in a
textfield, or on a checkbox

defaultButton: 'submitbutton'

so that when someone presses enter, we submit the form

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
window/Edit.js

index 8c699059e2946a69dbd4fff7858e4ebe6637d1e6..81ab5abd2026bfcb41968f80eab54afb941226e9 100644 (file)
@@ -25,6 +25,14 @@ Ext.define('Proxmox.window.Edit', {
 
     backgroundDelay: 0,
 
+    // needed for finding the reference to submitbutton
+    // because we do not have a controller
+    referenceHolder: true,
+    defaultButton: 'submitbutton',
+
+    // finds the first form field
+    defaultFocus: 'field',
+
     showProgress: false,
 
     isValid: function() {
@@ -225,6 +233,7 @@ Ext.define('Proxmox.window.Edit', {
        }
 
        var submitBtn = Ext.create('Ext.Button', {
+           reference: 'submitbutton',
            text: submitText,
            disabled: !me.create,
            handler: function() {