活动焦点& keychap不支持Android sencha extjs

时间:2016-12-01 06:31:29

标签: android extjs sencha-touch

我对事件聚焦事件有所了解Android上的Keyup, 我想知道为什么不支持, 当我在Pin Key上的标签没有向上并且键盘隐藏所有控制时, 但这个代码支持iOS,

希望你能解决这个问题

 focus: function(){
                                    var Athis = this.up('confirmation1');
                                    var txtValue = this.getValue().focus() == null ? 0 : this.getValue().length;
                                    Athis.onInputValue(txtValue, this, '');
                                },
                                keyup: function(){
                                    var Athis = this.up('confirmation1');
                                    var txtValue = this.getValue() == null ? 0 : this.getValue().length;


Ext.define('Test.view.Confirmation1',{

extend      : 'Ext.Panel'
,xtype      : 'confirmation1'

  ,config: {

    height: '100%',
    layout: 'vbox',
    scrollable: true,
    style: 'background-color: #E8D3B8;',

    items: [{
            {

                    xtype:'container',
                    layout: { type: 'hbox', pack: 'center' },
                    cls:'textblueNumberNew',
                    flex : 1,
                    items:[{

                        width: '70%',
                        minLength: 6,
                        maxLength: 6, 
                        xtype:'textcodefield',
                        cls: 'txtPassCodeTransparent',
                        itemId: 'txtPinCode',
                        reference: 'txtPinCode',
                        // id: 'pinCode',
                        clearIcon: false,
                        html: [
                            '<span class="passcodeStyleInput"><i class="fa fa-circle backgroundNone" aria-hidden="true"></i></span>',
                            '<span class="passcodeStyleInput"><i class="fa fa-circle backgroundNone" aria-hidden="true"></i></span>',
                            '<span class="passcodeStyleInput"><i class="fa fa-circle backgroundNone" aria-hidden="true"></i></span>',
                            '<span class="passcodeStyleInput"><i class="fa fa-circle backgroundNone" aria-hidden="true"></i></span>',
                            '<span class="passcodeStyleInput"><i class="fa fa-circle backgroundNone" aria-hidden="true"></i></span>',
                            '<span class="passcodeStyleInput"><i class="fa fa-circle backgroundNone" aria-hidden="true"></i></span>'
                            ].join(''),
                        listeners:{

                            blur: function(){
                                var Athis = this.up('confirmation1');
                                var txtValue = this.getValue() == null ? 0 : this.getValue().length;
                                Athis.onInputValue(txtValue, this, 'Blur');
                            },
                            focus: function(){
                                var Athis = this.up('confirmation1');
                                var txtValue = this.getValue().focus() == null ? 0 : this.getValue().length;
                                Athis.onInputValue(txtValue, this, '');
                            },
                            keyup: function(){
                                var Athis = this.up('confirmation1');
                                var txtValue = this.getValue() == null ? 0 : this.getValue().length;
                                Athis.onInputValue(txtValue, this, '');
                            },
                            change: function(){
                                var pinLength = this.getValue().length;
                                if (pinLength >6){
                                    this.setValue(this.getValue().toString().substring(0,6));    
                                }
                                var Athis = this.up('confirmation1');
                                var txtValue = this.getValue() == null ? 0 : this.getValue().length;
                                Athis.onInputValue(txtValue, this, '');
                            }
                        }

                    }]


                }
       }]
 }
})

1 个答案:

答案 0 :(得分:1)

在新的ext版本中,keyup事件仅在enableKeyEvents设置为true时触发。在您的文本字段中添加enableKeyEvents : true keyup事件将开始工作。另请查看Doc,您可以在其中验证enableKeyEvents以及焦点的工作原理。

当此组件获得焦点时触发。