问题描述
我再Ext页面中镶嵌了Ckeditor插件但是在Ckeditor下面在声明的其他组件就显示不了了..请各位大侠帮助俺一把代码是这样的:<body><script> Ext.QuickTips.init(); Ext.onReady(function(){ new Ext.Viewport({ id:'tviewport', height:500, width:300, items:[ { xtype:'textfield', value:'xiaoqiang' },{ width:500, height:400, items:{xtype: 'ckeditor',fieldLabel: '内 容',labelStyle : "text-align:right;width:50;", id:'neirong',name: 'htmlcode',CKConfig:{ toolbar :'Full', height : 180, uiColor: '#dede98', autoWidth:true } }},{ xtype:'textfield', value:'xiaoqiang' } ] }); }); </script></body>.哦..我用的Ckeditor3.5
解决方案
Ext.form.CKEditor = function(config) {this.config = config;Ext.form.CKEditor.superclass.constructor.call(this, config);};Ext.extend(Ext.form.CKEditor, Ext.form.TextArea, {hideLabel : true,constructor : function(config) {config = config || {};config.listeners = config.listeners || {};Ext.applyIf(config.listeners, {beforedestroy : this.onBeforeDestroy.createDelegate(this),scope : this});Ext.form.CKEditor.superclass.constructor.call(this, config);},onBeforeDestroy : function() {this.ckEditor.destroy();},onRender : function(ct, position) {if (!this.el) {this.defaultAutoCreate = {tag : "textarea",autocomplete : "off"};}Ext.form.TextArea.superclass.onRender.call(this, ct, position);this.ckEditor = CKEDITOR.replace(this.id, Ext.apply({skin : 'office2003'}, this.config.CKConfig));},setValue : function(value) {if (Ext.isEmpty(value)) {value = "";}Ext.form.TextArea.superclass.setValue.apply(this, [value]);CKEDITOR.instances[this.id].setData(value);},getValue : function() {CKEDITOR.instances[this.id].updateElement();this.value = CKEDITOR.instances[this.id].getData();return Ext.form.TextArea.superclass.getValue.apply(this);},getRawValue : function() {CKEDITOR.instances[this.id].updateElement();this.value = CKEDITOR.instances[this.id].getData();return Ext.form.TextArea.superclass.getRawValue.apply(this);}});Ext.reg('ckeditor', Ext.form.CKEditor);使用new Ext.form.CKEditor({xtype : 'ckeditor',name : 'content',width : '100%',height : 250});