求大神帮帮忙~
小弟感激不尽~
用的是ckeditor 4.6.2
注册控件
Ext.common.CKeditor = function(config){
this.config = config;
Ext.common.CKeditor.superclass.constructor.call(this, config);
};
Ext.extend(Ext.common.CKeditor, Ext.form.TextArea, {
onRender : function(ct, position){
if(!this.el){
this.defaultAutoCreate = {
tag: "textarea",
autocomplete: "off"
};
}
Ext.form.TextArea.superclass.onRender.call(this, ct, position);
CKEDITOR.replace(this.id, this.config.CKConfig);
},
setValue : function(value){
Ext.form.TextArea.superclass.setValue.apply(this,[value]);
CKEDITOR.instances[this.id].setData(value);
},
getValue : function(){
CKEDITOR.instances[this.id].updateElement();
return Ext.form.TextArea.superclass.getValue.call(this);
},
getRawValue : function(){
CKEDITOR.instances[this.id].updateElement();
return Ext.form.TextArea.superclass.getRawValue.call(this);
}
});
Ext.reg('ckeditor', Ext.common.CKeditor);
创建控件
var articleContent = new Ext.common.CKeditor({
fieldLabel: '文章内容',
id: 'articleContent',
name: 'articleContent',
width: 740,
height: 200
});
但是在向编辑框中写入数据的时候总是没有效果,result.content是在后台取到的数据,现在向后台存文本是没有问题的,就是显示不出来。
Ext.getCmp('articleContent').setValue(result.content);