• EXT3.3.1在IE9 IE10click事件 失效怎么解决


     各位Ext君有福了。

    var treePanel = new Ext.tree.TreePanel({
            id:'treePanel_'+(menuIndex++),//让菜单id可控
          title: title,
          lines:true,
          autoScroll:true,
          rootVisible:false,//控制是否显示树根节点
          loader: new Ext.tree.TreeLoader({
                preloadChildren: true,
                clearOnLoad: false
            }),
          root:new Ext.tree.AsyncTreeNode({
            text:'treeRoot',
                expanded:true,
                children:menuConfig
         }),
         listeners: {
                click: function(n,e) {
    
                    alert(1);
                    //menuJumpMethod(n,e);
                }
         }
        })

    并不生效怎么办。

    方案有两种:

    1、调整IE的兼容性策略

    在头部加入如下代码

    <meta http-equiv="X-UA-Compatible" content="IE=8" />

    这样的弊端是 将浏览器的文档解析力度下降达IE8,好端端的浏览器不支持h5了。

    2、此bug是由于ext-all.js中的getAttributeNS方法不能兼容IE10出错引起的,下载了ext3.4,这里的getAttributeNS 被重写了,将3.4中的方法写入3.2中的ext-all.js文件中,IE10中tree恢复正常。

    修改前:

    复制代码
    getAttributeNS: Ext.isIE ?
            function(s, q) {
                var t = this.dom,
                r = typeof t[s + ":" + q];
                if (!Ext.isEmpty(r) && r != "unknown") {
                    return t[s + ":" + q]
                }
                return t[q]
            }: function(r, q) {
                var s = this.dom;
                return s.getAttributeNS(r, q) || s.getAttribute(r + ":" + q) || s.getAttribute(q) || s[q]
            }
    复制代码

    修改后:

    复制代码
    getAttributeNS: function(m, l) {
                return this.getAttribute(l, m)
            },
            getAttribute: (function() {
                var p = document.createElement("table"),
                o = false,
                m = "getAttribute" in p,
                l = /undefined|unknown/;
                if (m) {
                    try {
                        p.getAttribute("ext:qtip")
                    } catch(n) {
                        o = true
                    }
                    return function(q, s) {
                        var r = this.dom,
                        t;
                        if (r.getAttributeNS) {
                            t = r.getAttributeNS(s, q) || null
                        }
                        if (t == null) {
                            if (s) {
                                if (o && r.tagName.toUpperCase() == "TABLE") {
                                    try {
                                        t = r.getAttribute(s + ":" + q)
                                    } catch(u) {
                                        t = ""
                                    }
                                } else {
                                    t = r.getAttribute(s + ":" + q)
                                }
                            } else {
                                t = r.getAttribute(q) || r[q]
                            }
                        }
                        return t || ""
                    }
                } else {
                    return function(q, s) {
                        var r = this.om,
                        u, t;
                        if (s) {
                            t = r[s + ":" + q];
                            u = l.test(typeof t) ? undefined: t
                        } else {
                            u = r[q]
                        }
                        return u || ""
                    }
                }
                p = null
            })()

    下载 EXT 3.4.1.1

  • 相关阅读:
    Golang 实现 Redis(9): 使用GeoHash 搜索附近的人
    Vuex的使用以及持久化的实现(2.0版本)
    Vue 手写一个 日期组件(简易)
    Makefile学习
    字符串的帧解析
    linux学习之工具
    CAN总线学习
    网页编程学习
    linux学习驱动之常用驱动
    linux学习之交叉编译环境
  • 原文地址:https://www.cnblogs.com/sexintercourse/p/6550888.html
Copyright © 2020-2023  润新知