分享

ExtJS 2.x 的 Menu 组件修正(override)

 windli笔记 2012-11-14
问题版本: ExtJS 2.2

修改了两点:

1. 如果 Menu 的项目太长,出滚动条。
2. 日期选择组件在 IE8 下面有一部分不显示。

代码如下:
Ext.override(Ext.menu.Menu, {
    showAt : function(xy, parentMenu, _e) {
        this.parentMenu = parentMenu;
        if (!this.el) {
            this.render();
        }
        if (_e !== false) {
            this.fireEvent("beforeshow", this);
            xy = this.el.adjustForConstraints(xy);
        }
        this.el.setXY(xy);

        var maxHeight = Ext.getBody().getHeight() - xy[1];
        if (this.el.getHeight() > maxHeight) {
            this.el.setHeight(maxHeight);
            this.el.applyStyles('overflow-y: auto;');
        }

        this.el.show();
        this.hidden = false;
        this.focus();
        this.fireEvent("show", this);
    },
    autoWidth : function() {
        if(/^\d+$/.test(this.width + '')) {
            this.width += "px";
        }
    }
});

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多