crysfel / Bleextop

An ExtJS4 desktop solution.
www.bleext.com
66 stars 20 forks source link

Login autofocus #12

Open livelysalt opened 12 years ago

livelysalt commented 12 years ago

Here is the way I've added autofocus for the username field at login:

https://github.com/crysfel/Bleextop/blob/master/js/Bleext/modules/login/LoginForm.js#L41

            items   : [{
                labelAlign  : "top",
                msgTarget   : 'side',
                fieldLabel  : "User",
                name        : "username",
                allowBlank  : false,
                flex        : 1,
                margins     : {right:3},
                listeners: {
                    render: function(f) {
                        f.findParentByType('window').defaultButton = f;
                    }
                }               
            },{

See: Sencha forum post