/javascript-mode/extjs.container

http://github.com/ridgetang/snippets · Unknown · 46 lines · 42 code · 4 blank · 0 comment · 0 complexity · 0d03fde63ea7482093e7c76785c266c0 MD5 · raw file

  1. # name : define container class
  2. # key : container
  3. # group : extjs
  4. # contributor : crazycode@gmail.com
  5. # This was cloned from a TextMate bundle for yasnippet.
  6. # --
  7. /**
  8. * @class $1
  9. * @extends $2
  10. * ${5:Description}
  11. */
  12. ${1:ClassName} = function(config) {
  13. var config = config || {};
  14. Ext.applyIf(config, {
  15. $0
  16. });
  17. $1.superclass.constructor.call(this, config);
  18. };
  19. Ext.extend($1, ${2:Ext.Container}, {
  20. /**
  21. * ${6:Renders the HTML for this container}
  22. * @param {Ext.Container} ct The container to render this component to
  23. * @param {Number} position The position within the parent container to render this component to
  24. */
  25. onRender: function(ct, position) {
  26. this.el = ct.createChild({
  27. $7
  28. });
  29. ${8:
  30. this.layoutTarget = this.el.child('${9:childSelector}');
  31. }
  32. $1.superclass.onRender.apply(this, arguments);
  33. },
  34. /**
  35. * Returns the element to add child components to
  36. * @return {Ext.Element\} The HTML element child components will be rendered to
  37. */
  38. getLayoutTarget: function() {
  39. return this.layoutTarget;
  40. \}
  41. });
  42. ${3:Ext.reg('${4:xtype}', $1);}