当前位置: 代码迷 >> Web前端 >> 改变Panel的作派
  详细解决方案

改变Panel的作派

热度:301   发布时间:2012-09-04 14:19:30.0
改变Panel的风格

Result

MyPanelBase has custom style

Js Code

Ext.onReady( function () {
     //base class
     Ext.define( 'MyPanelBase' , {
         extend: 'Ext.panel.Panel' ,
         width: 300,
         bodyPadding: 20,
         initComponent: function () {
             if ( this .$className == 'MyPanelBase' ) {
                 this .bodyStyle = "background-color: #ffc"
             }
 
             this .callParent(arguments);
         }
     });
     //derived class
     Ext.define( 'MyPanel' , {
         extend: 'MyPanelBase' ,
         initComponent: function () {
             console.log( 'MyPanel.initConponent' );
             this .callParent(arguments);
         }
     });
     //instance of MyPanelBase
     Ext.create( 'MyPanelBase' , {
         html: 'MyPanelBase has custom style' ,
         renderTo: 'output'
     });
     //instance of MyPanel
     Ext.create( 'MyPanel' , {
         html: 'MyPanel has no custom style' ,
         renderTo: 'output'
     })
});
?