ExtJS Extension


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

This has been heavily modified from the original.


Copy this code and paste it in your HTML
  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);

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.