`
jacky68147527
  • 浏览: 206835 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Ext禁止编辑HtmlEditor的方法

阅读更多
如果我们想要使用HtmlEditor只是用于显示数据时,需要禁止编辑Ext.form.HtmlEditor。

一般的做法都是通过设置readOnly : true  和disabled : true 但是你会发现,这样的做法根本不起作用。

这里我们需要重写HtmlEditor的disabled方法。

Ext.override(Ext.form.HtmlEditor, {  
    onDisable: function(){  
        if(this.rendered){  
            this.wrap.mask();  
        }  
        Ext.form.HtmlEditor.superclass.onDisable.call(this);  
    },  
    onEnable: function(){  
        if(this.rendered){  
            var roMask = this.wrap.mask();  
            roMask.dom.style.filter = "alpha(opacity=0);"; //IE  
            roMask.dom.style.opacity = "0"; //Mozilla  
            roMask.dom.style.background = "white";  
            roMask.dom.style.overflow = "scroll";   
        }  
        Ext.form.HtmlEditor.superclass.onEnable.call(this);  
    }  
}); 

这样,当你的HtmlEdior实例的disabled属性为true时就会禁止编辑!
分享到:
评论
2 楼 mailyxf 2013-07-03  
实现这个功能了,但是出现个问题,32位操作系统里面的内容看不见了,而64位的操作系统可以看到,这个问题肿么解决
1 楼 xticfc 2011-04-07  
是不能编辑了,但是滚动条也不能用了,所以不实用.

相关推荐

Global site tag (gtag.js) - Google Analytics