简体   繁体   English

ExtJs-奇怪的文本字段渲染行为

[英]ExtJs - Strange textfield render behavior

I am building a login window with ExtJs, using the following code : 我使用以下代码使用ExtJs构建登录窗口:

Ext.define('DTL.view.windows.LoginWindow', {
    extend : 'Ext.window.Window',
    alias : 'widget.login',
    id : 'loginWindow',

    autoShow : true,
    width : 400,
    height : 180,
    layout : 'border',
    border : false,
    modal : true,
    closable : false,
    resizable : false,
    draggable : false,

    initComponent : function () {
        this.items = [{
                region : 'north',
                height : 52,
                bodyCls : 'app_header'
            }, {
                id : 'login_form',
                region : 'center',
                xtype : 'form',
                bodyStyle : 'padding:10px; background: transparent;border-top: 0px none;',
                labelWidth : 75,
                defaultType : 'textfield',
                items : [{
                        fieldLabel : 'Username',
                        name : 'username',
                        id : 'usr',
                        allowBlank : false
                    }, {
                        fieldLabel : 'Password',
                        name : 'password',
                        inputType : 'password',
                        id : 'pwd',
                        allowBlank : false
                    }
                ]
            }
        ];

        this.buttons = [{
                id : 'login_button',
                text : 'Login',
                disabled : true
            }
        ];

        this.callParent(arguments);
    }
});

Now everything looks fine, except the fact that the password field has no borders. 现在,一切看起来都很好,但密码字段没有边框。

I tried various code modifications, but nothing helped. 我尝试了各种代码修改,但没有任何帮助。

Does anyone have an idea to fix this? 有谁有办法解决这个问题?

I am using ExtJs 4.0.7 我正在使用ExtJs 4.0.7

EDIT : 编辑:

I made another interesting discovery. 我发现了另一个有趣的发现。 If I add a third textfield the bug will move to that one. 如果我添加了第三个文本字段,则错误将移至该文本字段。

Apparently it affects always the last textfield. 显然,它总是影响最后一个文本字段。

The problem is caused by how you create the window. 问题是由您如何创建窗口引起的。 See this Sencha forum post: 看到这个Sencha论坛帖子:

Textfield Border Problem 文字框边框问题

ie you need to use Ext.create('DTL.view.windows.LoginWindow'); 也就是说,您需要使用Ext.create('DTL.view.windows.LoginWindow'); rather than xtype: 'login' 而不是xtype:'login'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM