日期:2014-05-17  浏览次数:20617 次

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时就会禁止编辑!
1 楼 xticfc 2011-04-07  
是不能编辑了,但是滚动条也不能用了,所以不实用.