首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >EXTjs字段容器焦点事件未触发

EXTjs字段容器焦点事件未触发
EN

Stack Overflow用户
提问于 2015-10-30 01:08:57
回答 1查看 769关注 0票数 0

我正在尝试让它在Sencha fiddle中工作。

代码语言:javascript
复制
Ext.application({
    name: 'Fiddle',

    launch: function() {

        Ext.create('Ext.form.Panel', {
            title: 'FieldContainer Example',
            width: 550,
            bodyPadding: 10,


            items: [{
                xtype: 'fieldcontainer',
                fieldLabel: 'Last Three Jobs',
                labelWidth: 100,
                listeners: {
                    focus: function(fld, e, opts) {
                        alert("onFocus");
                    }
                },

                // The body area will contain three text fields, arranged
                // horizontally, separated by draggable splitters.
                layout: 'hbox',
                items: [{
                    xtype: 'textfield',
                    flex: 1
                }, {
                    xtype: 'splitter'
                }, {
                    xtype: 'textfield',
                    flex: 1
                }, {
                    xtype: 'splitter'
                }, {
                    xtype: 'textfield',
                    flex: 1
                }]
            }],
            renderTo: Ext.getBody()
        });
    }
});
EN

回答 1

Stack Overflow用户

发布于 2015-11-01 13:49:42

您需要将焦点侦听器附加到文本字段上,而不是附加到字段容器上,因为它没有获得焦点。

代码语言:javascript
复制
items: [{
                    xtype: 'textfield',
                    flex: 1,
                    listeners: {
                        focus( a, event, eOpts ){
                            alert("onFocus");
                        }
                    },
                }, {
                    xtype: 'splitter'
                }, {
                    xtype: 'textfield',
                    flex: 1
                }, {
                    xtype: 'splitter'
                }, {
                    xtype: 'textfield',
                    flex: 1
                }]

工作代码here

希望这能有所帮助!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33420528

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档