[pve-devel] [PATCH manager] set default focus and default button for edit window
Emmanuel Kasper
e.kasper at proxmox.com
Wed Apr 19 19:14:35 CEST 2017
Tested OK, and looks good to me. A nice improvement for power users.
On 04/18/2017 04:55 PM, Dominik Csapak wrote:
> 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 at proxmox.com>
> ---
> www/manager6/window/Edit.js | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/www/manager6/window/Edit.js b/www/manager6/window/Edit.js
> index 147aa0b7..972d57fb 100644
> --- a/www/manager6/window/Edit.js
> +++ b/www/manager6/window/Edit.js
> @@ -20,6 +20,14 @@ Ext.define('PVE.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() {
> @@ -220,6 +228,7 @@ Ext.define('PVE.window.Edit', {
> }
>
> var submitBtn = Ext.create('Ext.Button', {
> + reference: 'submitbutton',
> text: submitText,
> disabled: !me.isCreate,
> handler: function() {
>
More information about the pve-devel
mailing list