zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    hdu 1199 Color the Ball 离散线段树
    poj 2623 Sequence Median 堆的灵活运用
    hdu 2251 Dungeon Master bfs
    HDU 1166 敌兵布阵 线段树
    UVALive 4426 Blast the Enemy! 计算几何求重心
    UVALive 4425 Another Brick in the Wall 暴力
    UVALive 4423 String LD 暴力
    UVALive 4872 Underground Cables 最小生成树
    UVALive 4870 Roller Coaster 01背包
    UVALive 4869 Profits DP
  • 原文地址:https://www.cnblogs.com/sexintercourse/p/6550888.html
Copyright © 2011-2022 走看看