Extjs - Extending Component Template


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. MyComponent = Ext.extend(Ext.some.component, {
  2. // Prototype Defaults, can be overridden by user's config object
  3. propA: 1,
  4.  
  5. initComponent: function(){
  6. // Called during component initialization
  7.  
  8. // Config object has already been applied to 'this' so properties can
  9. // be overriden here or new properties (e.g. items, tools, buttons)
  10. // can be added, eg:
  11. Ext.apply(this, {
  12. propA: 3
  13. });
  14.  
  15. // Before parent code
  16.  
  17. // Call parent (required)
  18. MyComponent.superclass.initComponent.apply(this, arguments);
  19.  
  20. // After parent code
  21. // e.g. install event handlers on rendered component
  22. },
  23.  
  24. // Override other inherited methods
  25. onRender: function(){
  26.  
  27. // Before parent code
  28.  
  29. // Call parent (required)
  30. MyComponent.superclass.onRender.apply(this, arguments);
  31.  
  32. // After parent code
  33.  
  34. }
  35. });
  36.  
  37. // register xtype to allow for lazy initialization
  38. Ext.reg('mycomponentxtype', MyComponent);

URL: http://www.sencha.com/learn/Manual:Component:Extending_Ext_Components

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.