其他分享
首页 > 其他分享> > ExtJS4.2下将表单元素放在菜单时不能进行拷贝的问题解决办法

ExtJS4.2下将表单元素放在菜单时不能进行拷贝的问题解决办法

作者:互联网

通过浏览器F12我们发现,在菜单对应的dom元素上面,有几个系统附加的事件处理函数,只要我们将它去掉就可以了。示意代码如下:

{
            xtype: "button",
            scope: zhuUx,
            menu: {
                xtype: 'menu',
                listeners: {
                    'show': function (me, eOpts) {
                        var cache;
                        var element = me.getEl();
                        var id = element.id;
                         var excludeEvents = ["mouseover", "mouseleave", "mouseenter"];
                        if (id && (cache = Ext.cache[id])) {
                            events = cache.events;

                            for (eventName in events) {
                                if (events.hasOwnProperty(eventName)) {
                                    if (Ext.Array.contains(excludeEvents, eventName)) {
                                        Ext.EventManager.removeListener(element, eventName);
                                    }
                                }
                            }
                            cache.events = {};
                        }
                    }
                },
                plain: true,
                items: [zhuUx.yinhuanLuduanForm]
            },
            flex: 0,
            width: 150,
            scale: 'medium',
            text: '隐患路线分段',
        }

  

标签:菜单,cache,events,eventName,ExtJS4.2,element,var,表单,id
来源: https://www.cnblogs.com/firesword/p/10567466.html