【问题标题】:EXTjs fieldcontainer focus event not firingEXTjs 字段容器焦点事件未触发
【发布时间】:2015-10-29 17:08:56
【问题描述】:

我正试图让它在 Sencha fiddle 中工作

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()
        });
    }
});

【问题讨论】:

    标签: extjs extjs5


    【解决方案1】:

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

    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

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-07
      • 1970-01-01
      • 2019-02-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多