EXTJS 5.1上的月份字段 [英] Month field on EXTJS 5.1

查看:135
本文介绍了EXTJS 5.1上的月份字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个真棒小提琴 https://fiddle.sencha.com/#fiddle/h5i从另一个堆栈溢出的帖子(感谢igor)。但是我有一个问题:如果我选择extjs版本5.1,这是我在应用程序中使用的版本,代码不起作用。问题是,当我点击一个月或一年,日历就会关闭(你可以尝试通过将版本设置为5.1并再次运行小提琴)。
我试图定制代码的部分,但没有改变:s。

I got this awesome fiddle https://fiddle.sencha.com/#fiddle/h5i from another stack overflow post (thanks igor). BUT I have one problem: the code doesn't work if I select extjs version 5.1, which is the version I use in my application. The problem is that when I click on a month or a year, the calendar just closes (you can try the behaviour by setting the version to 5.1 and running the fiddle again). I have tried to custom parts of the code, but nothing changed :s.

任何人都有任何想法,为什么这不适用于extjs 5.1,或者我如何解决问题?

Anyone has any ideas of why this doesn't work with extjs 5.1, or how could i workaround the problem ?

提前感谢:)

推荐答案

不知何故Chrome行为是不同的。尝试以下操作:

Somehow Chrome behavior is different. Try the following:

createPicker: function () {
    var me = this,
        format = Ext.String.format,
        pickerConfig;

    pickerConfig = {
        pickerField: me,
        ownerCmp: me,
        renderTo: document.body,
        floating: true,
        hidden: true,
        focusOnShow: true,
        minDate: me.minValue,
        maxDate: me.maxValue,
        disabledDatesRE: me.disabledDatesRE,
        disabledDatesText: me.disabledDatesText,
        disabledDays: me.disabledDays,
        disabledDaysText: me.disabledDaysText,
        format: me.format,
        showToday: me.showToday,
        startDay: me.startDay,
        minText: format(me.minText, me.formatDate(me.minValue)),
        maxText: format(me.maxText, me.formatDate(me.maxValue)),
        listeners: {
            select: { scope: me, fn: me.onSelect },
            monthdblclick: { scope: me, fn: me.onOKClick },
            yeardblclick: { scope: me, fn: me.onOKClick },
            OkClick: { scope: me, fn: me.onOKClick },
            CancelClick: { scope: me, fn: me.onCancelClick }
        },
        keyNavConfig: {
            esc: function () {
                me.collapse();
            }
        }
    };

    if (Ext.isChrome) {
        me.originalCollapse = me.collapse;
        pickerConfig.listeners.boxready = {
            fn: function () {
                this.picker.el.on({
                    mousedown: function () {
                        this.collapse = Ext.emptyFn;
                    },
                    mouseup: function () {
                        this.collapse = this.originalCollapse;
                    },
                    scope: this
                });
            },
            scope: me,
            single: true
        }
    }

    return Ext.create('Ext.picker.Month', pickerConfig);
}

这篇关于EXTJS 5.1上的月份字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆