PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/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
15  Ext.applyIf(config, {
16    $0
17  });
18
19  $1.superclass.constructor.call(this, config);
20};
21Ext.extend($1, ${2:Ext.Container}, {
22  /**
23   * ${6:Renders the HTML for this container}
24   * @param {Ext.Container} ct The container to render this component to
25   * @param {Number} position The position within the parent container to render this component to
26   */
27  onRender: function(ct, position) {
28    this.el = ct.createChild({
29      $7
30    });
31${8:
32    this.layoutTarget = this.el.child('${9:childSelector}');
33}
34    $1.superclass.onRender.apply(this, arguments);
35  },
36
37  /**
38   * Returns the element to add child components to
39   * @return {Ext.Element\} The HTML element child components will be rendered to
40   */
41  getLayoutTarget: function() {
42    return this.layoutTarget;
43  \}
44});
45
46${3:Ext.reg('${4:xtype}', $1);}