单击Sencha Touch中的selectField打开键盘

时间:2016-10-27 05:52:30

标签: javascript extjs sencha-touch sencha-touch-2.1

我使用selectfield控件在我的应用中显示了一个下拉列表。单击箭头按钮时工作正常,但当用户点击文本(输入区域)时,键盘也会打开。它不是输入字段。

enter image description here

这是我的代码:

{
    xtype: 'panel',
    itemId: 'mypanel23',
    listeners: {
        fn: function (component, eOpts) {
            component.add({
                /***DropDown issue***/
                xtype: sessionStorage.voiceOver == "on" ? 'panel' : 'selectfield',
                /***DropDown issue***/
                cls: 'myusage_select_list',
                id: 'billedDD',
                itemId: 'myselectfield',
                hideOnMaskTap: true,
                /***DropDown issue***/
                html: sessionStorage.voiceOver == "on" ? "<select class='myusage_select_list' id='billedDD_Accessibility'></select>" : '',
                /***DropDown issue***/
                defaultPhonePickerConfig: {
                    cancelButton: {
                        text: BellMCare.util.config.getLocalizationValue('MobilityMyUsage_Cancel'),
                        listeners: {
                            tap: function () {
                                var uAgent = navigator.userAgent;
                                if (uAgent.match(/Alcatel/i)) {
                                    this.up('picker').setHidden(true);
                                }
                            }
                        }
                    },
                    doneButton: {
                        //Sanity Issue - expiry date picker not working and screen struck                                
                        cls: 'pickerDoneBtn',
                        // Sanity Issue -End
                        text: BellMCare.util.config.getLocalizationValue('MobilityMyUsage_Done'),
                        listeners: {
                            tap: function () {
                                BellMCare.util.config.performanceLogs('PERFORMANCE LOGS | UI | Flow 4b | start ');

                                BellMCare.util.config.performanceLogs('PERFORMANCE LOGS | UI | Flow 4a or 4b  | Changed dropdown started  ');

                                var uAgent = navigator.userAgent;
                                if (uAgent.match(/Alcatel/i)) {
                                    this.up('picker').setHidden(true);
                                }
                            }
                        }
                    }
                },
                listeners: {
                    change: function (selectfield, newValue, oldValue, eOpts) {
                        if (oldValue != null) {
                            /**Dropdown Issue**/
                            BellMCare.app.getController("mobilityMyUsage").onBillCycleDropDownChange();
                            /**Dropdown Issue**/
                        }
                    },
                    focus: function (comp) {
                        var uAgent = navigator.userAgent;
                        if (uAgent.match(/Alcatel/i)) {
                            if (comp.getPhonePicker().isHidden()) {
                                comp.getPhonePicker().setHidden(false);
                            }
                        }
                    }
                }
            });
            /**Dropdown Issue**/
            Ext.getCmp("billedDD").innerHtmlElement.dom.addEventListener("change", function () {
                BellMCare.app.getController("mobilityMyUsage").onBillCycleDropDownChange();
            });
            /**Dropdown Issue**/
        },
        event: 'initialize'
    }
}

1 个答案:

答案 0 :(得分:2)

我通过以下代码管理它:

initialize: function(fld){
    var textboxEl = fld.element.query('input')[0];
    textboxEl.setAttribute('readonly', true);
}

如果您有任何疑问,请告诉我。