HtmlComponent

Discuss about Group-Office development here

Moderator: Developers

jamesarthur
Posts: 55
Joined: Fri Nov 08, 2013 9:15 am

HtmlComponent

Postby jamesarthur » Sat Feb 22, 2014 3:29 pm

HI

I implemented some extra functionality on the htmlcomponent. I post the changes below in the hope they will be useful to you guys.

Code: Select all

GO.form.HtmlComponent = Ext.extend(Ext.BoxComponent, {
   
   constructor : function(config) {
      GO.form.HtmlComponent.superclass.constructor.call(this, config);
      this.origHtml = this.html;
   },
   
   onRender : function(ct, position){
      this.el = ct.createChild({
         tag: 'div',
         html: this.html,
         cls: this.cls,
         style:this.style
      });
   },
   // Added because otherwise you get an JS error about this function does not exist for this element
   // when you add this to forms
   reset : function(){
      if(this.html !== this.origHtml) {
         this.html = this.origHtml;
         if(this.rendered) {
            this.el.update(this.origHtml);
         }
      }
      return this;
   },
   
   // Added because otherwise you get an JS error about this function does not exist for this element
   clearInvalid : function(){
      return this;
   },
   // Added because otherwise you get an JS error about this function does not exist for this element
   validate : function(){
      return true; // True because a heading is always valid
   },
   setValue : function(v){
      this.html = v;
      if(this.rendered) {
         this.el.update(v);
      }
   }
});

Ext.reg('htmlcomponent', GO.form.HtmlComponent);

Return to “Development Chats”

Who is online

Users browsing this forum: No registered users and 1 guest