Re: [pve-devel] [PATCH pve-manager] SafeDestroy.js: allow to submit the form with Enter key
On 03/31/2016 10:29 AM, Dietmar Maurer wrote: > >> @@ -102,7 +108,12 @@ Ext.define('PVE.window.SafeDestroy', { >> fieldLabel: gettext('Please enter the {item.type} ID to >> confirm'), >> }, >> hideTrigger: true, >> -allowBlank: false >> +allowBlank: false, >> +listeners: { >> +afterrender: function(field) { >> +field.focus(10); >> +} >> +} > > Can we move this code to the ViewController instead? > On second thought, it would be maybe even better to use the framework focus handling helpers like Ext.define('PVE.window.SafeDestroy', { bodyPadding: 10, width: 450, layout: 'hbox', +defaultFocus: 'confirmField', and reference: 'confirmField', + itemId: 'confirmField', xtype: 'numberfield', name: 'confirm', labelWidth: 300, like we use for the Login Window ? I'll send a V2 patch with this. ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH pve-manager] SafeDestroy.js: allow to submit the form with Enter key
> @@ -102,7 +108,12 @@ Ext.define('PVE.window.SafeDestroy', { > fieldLabel: gettext('Please enter the {item.type} ID to > confirm'), > }, > hideTrigger: true, > - allowBlank: false > + allowBlank: false, > + listeners: { > + afterrender: function(field) { > + field.focus(10); > + } > + } Can we move this code to the ViewController instead? ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-manager] SafeDestroy.js: allow to submit the form with Enter key
also set focus on the confirm field of the Destroy Window on display --- www/manager6/window/SafeDestroy.js | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/www/manager6/window/SafeDestroy.js b/www/manager6/window/SafeDestroy.js index ec4a2f5..fea9594 100644 --- a/www/manager6/window/SafeDestroy.js +++ b/www/manager6/window/SafeDestroy.js @@ -53,6 +53,12 @@ Ext.define('PVE.window.SafeDestroy', { } else { removeButton.disable(); } + }, + specialkey: function (field, event) { + var removeButton = this.lookupReference('removeButton'); + if (!removeButton.isDisabled() && event.getKey() == event.ENTER) { + removeButton.fireEvent('click', removeButton, event); + } } }, 'button[reference=removeButton]': { @@ -102,7 +108,12 @@ Ext.define('PVE.window.SafeDestroy', { fieldLabel: gettext('Please enter the {item.type} ID to confirm'), }, hideTrigger: true, - allowBlank: false + allowBlank: false, + listeners: { + afterrender: function(field) { + field.focus(10); + } + } } ], } -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel