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时就会禁止编辑!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值