Advertisement
shmaltorhbooks

Untitled

Jun 12th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. App.SuperPanel = Ext.extend(Ext.Panel, {
  2.     // initComponent вызывается у всех компонентов, которые видны
  3.     // если надо расширить какой-то store - юзай constructor вместо initComponent
  4.     initComponent: function(){
  5.         // applyIf применяет только если параметры не переданы
  6.         Ext.applyIf(this, {
  7.             title: 'defaultTitle',
  8.             html: 'defaultHtml',
  9.             buttons: [{
  10.                 text: 'defaultButton',
  11.                 handler: function(){
  12.                     console.log('default handler');
  13.                     console.log(this);
  14.                     console.log(this.ownerCt);
  15.                 }
  16.             }]
  17.         });
  18.         // apply применяет полюбому
  19.         Ext.apply(this, {
  20.             closable: true
  21.         })
  22.         // парентовый конструктор
  23.         App.SuperPanel.superclass.initComponent.call(this);
  24.     }
  25. });
  26.  
  27. // defaults
  28. new App.SuperPanel({});
  29.  
  30. new App.SuperPanel({
  31.     title: 'title changed'
  32. });
  33.  
  34. new App.SuperPanel({
  35.     html: 'html changed'
  36. });
  37.  
  38. new App.SuperPanel({
  39.     buttons: [{
  40.         text: 'button changed'
  41.     }]
  42. });
  43.  
  44. new App.SuperPanel({
  45.     title: 'everything changed, except closable',
  46.     html:  'everything changed, except closable',
  47.     closable: false,
  48.     buttons: [{
  49.         text:  'everything changed, except closable'
  50.     }]
  51. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement