Posted By

JimBarrows on 03/02/10


Tagged

extend extjs


Versions (?)

ExtJS Extension


 / Published in: JavaScript
 

URL: http://www.extjs.com/learn/Tutorial:Extending_Ext2_Class

This has been heavily modified from the original.

  1. Ext.namespace('Namespace');
  2. Namespace.AnExtension = Ext.extend(Ext.Panel, {
  3.  
  4. // ,constructor:function(config) {
  5. // // constructor pre-processing - configure listeners here
  6. // config = config || {};
  7. // config.listeners = config.listeners || {};
  8. // Ext.applyIf(config.listeners, {
  9. // expand:{scope:this, fn:function() {
  10. // }}
  11. // ,collapse:{scope:this, fn:function() {
  12. // }}
  13. // });
  14. //
  15. //
  16. // Namespace.AnExtension.superclass.constructor.apply(this, arguments);
  17. //
  18. // // constructor post-processing
  19. //
  20. // },
  21.  
  22. initComponent: function() {
  23.  
  24. var config = {};
  25.  
  26. // apply config
  27. Ext.apply(this, config);
  28. Ext.apply(this.initialConfig, config);
  29.  
  30. Namespace.AnExtension.superclass.initComponent.apply(this, arguments);
  31.  
  32. // after parent code here, e.g. install event handlers
  33. // this.on('beforerender', function(dis) {
  34. // alert('before render');
  35. // });
  36. }
  37.  
  38. ,
  39. onRender: function() {
  40.  
  41. Namespace.AnExtension.superclass.onRender.apply(this, arguments);
  42.  
  43. }
  44.  
  45. // any other added/overrided methods
  46. });
  47.  
  48. Ext.reg('Namespace.AnExtension', Namespace.AnExtension);

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: JimBarrows on March 2, 2010

copy paste replace anextension and AnExtenssion with a usable name.

You need to login to post a comment.